-
-
Notifications
You must be signed in to change notification settings - Fork 785
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
onRequestClose prop #1318
Comments
Can you solve your usecase by listening to index = |
The other way is to use the |
I've tried both, but it doesn't work as intended. Especially not since you want the |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
This issue was closed because it has been stalled for 5 days with no activity. |
Feature Request
An onRequestClose prop on the BottomSheet. This prop should accept a function returning a Promise, which should be run between user dismissal/closing interaction and the sheet actually closing (to index -1). The return value of the promise should in turn decide whether to proceed with closing the sheet.
Why it is needed
In certain situations, it would be very useful to be able to interrupt any dismissal/closing of the sheet, eg. if there is unsaved changes in a form, or if some process is running. This would eg. allow you to prompt the user with an alert to confirm ending whatever workflow they are currently in.
Possible implementation
Almost as described above. I actually made it work by adding the onRequestClose prop to the sheet, and injecting that function in the handleClose handler. But this only works for dismissal of the sheet by either pressing the backdrop or running the .close() ref handler, and not when closing with the pan down to close gesture. I would love to make a PR, but I think I need help or guidance to make it work with the panning gesture as well.
Code sample
I imagine the use of onRequestClose prop something like:
The text was updated successfully, but these errors were encountered: