fix (iOS): Swipe down to dismiss screen with ScrollView on iOS #1902
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Following the changes done in PR #1512, we encountered an issue where we couldn't swipe down to dismiss a modal screen on iOS if this screen contained a ScrollView.
To fix this, we made some check in the
RNSScreenStack.mm
file, more specifically in the- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
method to check if the gesture is coming from a ScrollView, and if so, check if this scroll view's content offset is less than or equal to 0. If so, we allow the swipe to dismiss gesture and cancel the scroll view's gesture.Changes
RNNScreenStack.mm
TestsExample
Screenshots / GIFs
Simulator.Screen.Recording.-.iPhone.14.Pro.-.2023-09-26.at.10.39.56.mp4
Test code and steps to reproduce
See Test1902 in
TestsExample
. In order to enable this feature, you need to have these options :Checklist