diff --git a/guides/GUIDE_FOR_LIBRARY_AUTHORS.md b/guides/GUIDE_FOR_LIBRARY_AUTHORS.md index 333d135c80..45f8a4a19f 100644 --- a/guides/GUIDE_FOR_LIBRARY_AUTHORS.md +++ b/guides/GUIDE_FOR_LIBRARY_AUTHORS.md @@ -80,8 +80,6 @@ When set to `false` the back swipe gesture will be disabled. The default value i #### `gestureResponseDistance` (iOS only) Use it to restrict the distance from the edges of screen in which the gesture should be recognized. To be used alongside `fullScreenSwipeEnabled`. The responsive area is covered with 4 values: `start`, `end`, `top`, `bottom`. Example usage: -IMPORTANT: Starting from iOS 26, this prop conflicts with the native behavior of full screen swipe to dismiss, therefore it is ignored. - ```tsx gestureResponseDistance: { start: 200, diff --git a/ios/RNSScreenStack.mm b/ios/RNSScreenStack.mm index 8564033994..91d07c8163 100644 --- a/ios/RNSScreenStack.mm +++ b/ios/RNSScreenStack.mm @@ -863,24 +863,21 @@ - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer // On iOS < 26, we have a custom full screen swipe recognizer that functions similarily // to interactiveContentPopGestureRecognizer introduced in iOS 26. // On iOS >= 26, we want to use the native one, but we are unable to handle custom animations - // with native interactiveContentPopGestureRecognizer, so we have to fallback to the old implementation. - // In this case, the old one should behave as close as the new native one, having only the difference - // in animation, and without any customization that is exclusive for it (e.g. gestureResponseDistance). + // with native interactiveContentPopGestureRecognizer, so we have to fallback to the old implementation + // for this one case only. if (@available(iOS 26, *)) { - if (customAnimationOnSwipePropSetAndSelectedAnimationIsCustom) { - _isFullWidthSwipingWithPanGesture = YES; - [self cancelTouchesInParent]; - return YES; - } - return NO; - } else { - if ([self isInGestureResponseDistance:gestureRecognizer topScreen:topScreen]) { - _isFullWidthSwipingWithPanGesture = YES; - [self cancelTouchesInParent]; - return YES; + if (!customAnimationOnSwipePropSetAndSelectedAnimationIsCustom) { + return NO; } - return NO; } + + if ([self isInGestureResponseDistance:gestureRecognizer topScreen:topScreen]) { + _isFullWidthSwipingWithPanGesture = YES; + [self cancelTouchesInParent]; + return YES; + } + + return NO; } // Now we're dealing with RNSScreenEdgeGestureRecognizer (or _UIParallaxTransitionPanGestureRecognizer) @@ -905,6 +902,15 @@ - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer // it should only recognize with `customAnimationOnSwipe` set return NO; } +#if RNS_IPHONE_OS_VERSION_AVAILABLE(26_0) + if (@available(iOS 26, *)) { + if (gestureRecognizer == _controller.interactiveContentPopGestureRecognizer && + ![self isInGestureResponseDistance:gestureRecognizer topScreen:topScreen]) { + return NO; + } + } +#endif // check for iOS >= 26 + // _UIParallaxTransitionPanGestureRecognizer (other...) [self cancelTouchesInParent]; return YES; diff --git a/src/types.tsx b/src/types.tsx index 046156f8f5..bbc3056bc1 100644 --- a/src/types.tsx +++ b/src/types.tsx @@ -207,8 +207,6 @@ export interface ScreenProps extends ViewProps { /** * Use it to restrict the distance from the edges of screen in which the gesture should be recognized. To be used alongside `fullScreenSwipeEnabled`. * - * @deprecated since iOS 26, this prop conflicts with the native behavior of full screen swipe to dismiss, therefore it is ignored. - * * @platform ios */ gestureResponseDistance?: GestureResponseDistanceType;