Skip to content
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

fix (iOS): Swipe down to dismiss screen with ScrollView on iOS #1902

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RaphBlanchet
Copy link

@RaphBlanchet RaphBlanchet commented Sep 26, 2023

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

  • Added fix in RNNScreenStack.mm
  • Added a reproducible example Test1902 in 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 :

animation: 'slide_from_bottom',
fullScreenGestureEnabled: true, 
gestureDirection: 'vertical'

Checklist

@RaphBlanchet RaphBlanchet changed the title fix: Swipe down to dismiss screen with ScrollView on iOS fix (iOS): Swipe down to dismiss screen with ScrollView on iOS Sep 26, 2023
@tboba tboba requested review from kkafar and tboba December 14, 2023 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant