Implement interactive dismiss for iOS modals#38641
Implement interactive dismiss for iOS modals#38641jacobp100 wants to merge 1 commit intofacebook:mainfrom
Conversation
| const onDismiss = () => { | ||
| setVisible(false); | ||
| if (action === 'onDismiss') { | ||
| if (action === 'On Dismiss') { |
There was a problem hiding this comment.
I'm pretty sure these were always broken. I've fixed them anyway
Base commit: 3c6dbec |
|
Thanks so much for opening this @jacobp100!! @NickGerleman @philIip this has been needed for so so long, any chance of moving it forward? |
|
@NickGerleman apologies for randomly pinging you, just not sure how to get eyes on this and you seem pretty active. This PR is very small and a slam dunk - we cannot pull down on modals to close them in iOS and users expect it. This fixes that. Any chance of a merge? The conflict looks to be limited to the example file only. |
|
This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
Still needed. |
|
@philIip 🙏 |
|
Would love for this to get merged as well |
|
This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
lol 2 years folks |
|
@cipolleschi sorry for the ping, just realized the assigned reviewer doesn't seem to be active anymore, and you seem to be working in somewhat related functionality. Just a cc in case this is still worth a look. Would be great to have. |

Summary:
Currently the swipe-to-dismiss gesture for iOS doesn't work well - it applies friction so you can't pull it down more than a certain amount. The intention for this - from Apple - was if you're editing a form, and you didn't want to accidentally dismiss it. When the user does this gesture, it should be followed by an alert asking them if they wanted to save or cancel
When you're not editing a form, you don't want this friction applied, so the modal can be swiped all the way off the screen. That's what this PR implements via the opt-in prop
preventNativeDismiss(=true). The name comes from react-native-screensThis is opt-in and defaults to
true(the current behaviour), so there's no breaking changesSee video below
Changelog:
[IOS] [ADDED] - Added
preventNativeDismissprop to modal to opt-in to drag-to-dismiss gestures for modalsTest Plan:
RN Tester
Simulator.Screen.Recording.-.iPhone.SE.3rd.generation.-.2023-07-26.at.17.22.33.mp4