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

Feature: onRequestClose #1320

Closed
wants to merge 4 commits into from

Conversation

Stenbaek
Copy link

Please provide enough information so that others can review your pull request:

About

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.

Motivation

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.

Attempts to solve feature request #1318

Stenbaek added 3 commits March 9, 2023 13:23
Prop added to the types
Handler injected in the handleClose callback. Awaits the promise return, and if this is true, prevents the sheet from closing
@Stenbaek Stenbaek mentioned this pull request Mar 10, 2023
@github-actions
Copy link

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant