Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion ios/RNSScreenStack.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,14 @@ - (BOOL)isScrollViewPanGestureRecognizer:(UIGestureRecognizer *)gestureRecognize
return scrollView.panGestureRecognizer == gestureRecognizer;
}

// Check if ScrollView has horizontal scrolling.
// This is the same logic as in RCTScrollView:
// https://github.com/facebook/react-native/blob/69b131c2b1627f64f34a534dac4cf48a542e6ea6/packages/react-native/React/Views/ScrollView/RCTScrollView.m#L557
- (BOOL)scrollViewHasHorizontalPart:(UIScrollView *)scrollView
{
return scrollView.contentSize.width > scrollView.frame.size.width;
}

// Custom method for compatibility with iOS < 13.4
// RNSScreenStackView is a UIGestureRecognizerDelegate for three types of gesture recognizers:
// RNSPanGestureRecognizer, RNSScreenEdgeGestureRecognizer, _UIParallaxTransitionPanGestureRecognizer
Expand Down Expand Up @@ -1253,7 +1261,10 @@ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
if (@available(iOS 26, *)) {
if (gestureRecognizer == _controller.interactiveContentPopGestureRecognizer &&
[self isScrollViewPanGestureRecognizer:otherGestureRecognizer]) {
return YES;
// ScrollView should take precedence when scrolling horizontally (it should be required to fail).
// However, if it does not allow for horizontal scrolling, there should be no such restriction,
// and swiping horizontally should dismiss the screen.
return [self scrollViewHasHorizontalPart:static_cast<UIScrollView *>(otherGestureRecognizer.view)];
}
}

Expand All @@ -1276,6 +1287,7 @@ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
}
#endif // check for iOS >= 26

// edge swipe to dismiss should take precedence over scrolling (both horizontally and vertically)
return isEdgeSwipeGestureRecognizer && [self isScrollViewPanGestureRecognizer:otherGestureRecognizer];
}

Expand Down
Loading