Skip to content

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

Open
RaphBlanchet wants to merge 2 commits into
software-mansion:mainfrom
RaphBlanchet:@RaphBlanchet/ios-swipe-dismiss
Open

fix (iOS): Swipe down to dismiss screen with ScrollView on iOS#1902
RaphBlanchet wants to merge 2 commits into
software-mansion:mainfrom
RaphBlanchet:@RaphBlanchet/ios-swipe-dismiss

Conversation

@RaphBlanchet
Copy link
Copy Markdown

@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
@alecmarcus
Copy link
Copy Markdown

Is merging this PR on anybody's radar? It's a valuable fix that I will have to pull in as a patch.

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.

3 participants