-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
Implement interactive dismiss for iOS modals #38641
base: main
Are you sure you want to change the base?
Conversation
const onDismiss = () => { | ||
setVisible(false); | ||
if (action === 'onDismiss') { | ||
if (action === 'On Dismiss') { |
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'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 |
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
preventNativeDismiss
prop 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