-
Notifications
You must be signed in to change notification settings - Fork 451
Fix: Navigation gesture gestureResponseDistance failure #1016
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix: Navigation gesture gestureResponseDistance failure #1016
Conversation
@kazhoang could you resolve the conflicts 🙏 ? |
… into fix/gesture-response-distance-navigation-failure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a navigation gesture issue in PagerView where iOS fullscreen swipe-back gestures fail when using React Navigation's native stack with gestureResponseDistance
. The fix allows navigation gestures to work properly when the pager is at index 0.
Key changes:
- Added
allowNavFullscreenGesture
prop to enable navigation gesture passthrough - Implemented gesture recognition logic to handle conflicts between pager and navigation gestures
- Added comprehensive gesture state management for iOS
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/PagerViewNativeComponent.ts | Added TypeScript interface for new allowNavFullscreenGesture prop |
ios/RNCPagerViewComponentView.mm | Implemented core gesture handling logic with UIGestureRecognizerDelegate |
android/src/main/java/com/reactnativepagerview/PagerViewViewManager.kt | Added stub implementation for Android compatibility |
README.md | Added documentation for the new prop |
Comments suppressed due to low confidence (1)
ios/RNCPagerViewComponentView.mm:103
- The variable name 'p' is too short and ambiguous. Consider renaming it to 'panGestureRecognizer' or 'panGesture' for better readability.
UIPanGestureRecognizer* p = (UIPanGestureRecognizer*) gestureRecognizer;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kazhoang
Thank you for addressing all our feedback. Let's wait for more feedback from other devs. I will try to find time this week to check it.
Once everything is in order, we will merge and release it.
ios/RNCPagerViewComponentView.mm
Outdated
@@ -173,6 +205,22 @@ - (void)updateProps:(const facebook::react::Props::Shared &)props oldProps:(cons | |||
_overdrag = newScreenProps.overdrag; | |||
} | |||
|
|||
if (newScreenProps.allowNavFullscreenGesture != _allowNavFullscreenGesture) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should check previous screen properties in here. Same as other props
ios/RNCPagerViewComponentView.mm
Outdated
@@ -173,6 +205,22 @@ - (void)updateProps:(const facebook::react::Props::Shared &)props oldProps:(cons | |||
_overdrag = newScreenProps.overdrag; | |||
} | |||
|
|||
if (newScreenProps.allowNavFullscreenGesture != _allowNavFullscreenGesture) { | |||
_allowNavFullscreenGesture = newScreenProps.allowNavFullscreenGesture; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we also don't need to store this as it's stored in _props.allowNavFullscreenGesture
for us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@okwasniewski
I’m encountering issues with oldScreenProps.allowNavFullscreenGesture
due to the recycling process while re-enter the pager-view. (It keeps the old properties)
This is why I’m using an additional local property to control it
(as otherwise, it skips attaching the navGestureRecognizer since it’s already been cleaned up)

…ure for clarity and consistency and remove unnecessary properties
Summary
#Before
Screen.Recording.2025-08-01.at.14.49.12.mov
#After
Screen.Recording.2025-08-01.at.14.47.45.mov
Test Plan
"react-native": "0.79.5" (New Architect)
"react-native-pager-view": "^6.8.1"
"@react-navigation/native": "^7.1.16",
"@react-navigation/native-stack": "^7.3.23",
Set screen options:
then in the screen:
What's required for testing (prerequisites)?
What are the steps to reproduce (after prerequisites)?
Compatibility
Checklist
README.md