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
[v4] | [v2] Modal not dismissing #1775
Comments
Same issue |
Same issue, it's causing users to complain about "freezing" and needing to force close the app |
Is there any solution to this problem? |
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. |
Hi, |
Bug
We are using multiple modals (open at the same time) in our project.
There are instances when closing the modal either tapping outside of the modal or calling
dismiss
fromuseBottomSheetModal
hook,useAnimatedReaction
hook callback is invoke multiple times. This will then invoke_providedOnClose
->handleUnmountSheet
ofBottomSheetModalProvider
.react-native-bottom-sheet/src/components/bottomSheet/BottomSheet.tsx
Line 1582 in 2b37e06
Given that
handleUnmountSheet
ofBottomSheetModalProvider
will be invoke multiple times using the same key,sheetsQueueRef
will be updated depending on the number of calls which may result on an empty array.If possible to have a guard in
handleUnmountSheet
that ifsheetIndex
is -1, succeeding codes will not be executed.react-native-bottom-sheet/src/components/bottomSheetModalProvider/BottomSheetModalProvider.tsx
Line 89 in 2b37e06
The problem now is we only expected to remove only the top most modal in
sheetsQueueRef
but since unmount is called multiple times even the other modals were removed.Even if we call
dismissAll
fromuseBottomSheetModal
, the modal is still not closing.Environment info
Steps To Reproduce
Expected Behavior:
The first modal should be closed
Actual Behavior:
The first modal is not closing
Reproducible sample code
The text was updated successfully, but these errors were encountered: