From fb5098c5fb380ca2f90498e82c57608616c4e461 Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Sat, 3 Feb 2024 23:46:32 +0100 Subject: [PATCH] feat: add visionOS support --- RNGestureHandler.podspec | 2 +- apple/Handlers/RNFlingHandler.m | 2 +- apple/Handlers/RNForceTouchHandler.m | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/RNGestureHandler.podspec b/RNGestureHandler.podspec index 8d4a06c621..1798c7249b 100644 --- a/RNGestureHandler.podspec +++ b/RNGestureHandler.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/software-mansion/react-native-gesture-handler", :tag => "#{s.version}" } s.source_files = "apple/**/*.{h,m,mm}" s.requires_arc = true - s.platforms = { ios: apple_platform, tvos: apple_platform, osx: '10.15' } + s.platforms = { ios: apple_platform, tvos: apple_platform, osx: '10.15', visionos: '1.0' } if defined?(install_modules_dependencies()) != nil install_modules_dependencies(s); diff --git a/apple/Handlers/RNFlingHandler.m b/apple/Handlers/RNFlingHandler.m index 91882fac34..6c1d8d3dc2 100644 --- a/apple/Handlers/RNFlingHandler.m +++ b/apple/Handlers/RNFlingHandler.m @@ -143,7 +143,7 @@ - (RNGestureHandlerEventExtraData *)eventExtraData:(id)_recognizer CGPoint viewAbsolutePosition = [recognizer.view convertPoint:recognizer.view.bounds.origin - toView:[UIApplication sharedApplication].keyWindow.rootViewController.view]; + toView:RCTKeyWindow().rootViewController.view]; CGPoint locationInView = [recognizer getLastLocation]; return [RNGestureHandlerEventExtraData diff --git a/apple/Handlers/RNForceTouchHandler.m b/apple/Handlers/RNForceTouchHandler.m index f0c70fa16a..e96aa0427b 100644 --- a/apple/Handlers/RNForceTouchHandler.m +++ b/apple/Handlers/RNForceTouchHandler.m @@ -86,7 +86,7 @@ - (BOOL)shouldFail - (void)performFeedbackIfRequired { -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_VISION if (_feedbackOnActivation) { if (@available(iOS 10.0, *)) { [[[UIImpactFeedbackGenerator alloc] initWithStyle:(UIImpactFeedbackStyleMedium)] impactOccurred];