react-navigation-bottom-sheet
react-navigation-bottom-sheet copied to clipboard
Closing all open modals.
It seems really hard to close all open modals. I have two modals that are open using stackBehavior: 'replace'.
The second modal contains a form that navigates to a different screen on submit. When I submit, it navigates to the new screen, and then opens the old modal again.
I have tried calling dismissAll from useBottomSheetModal. I have tried doing calling Navigation.goBack() and then Navigation.navigate.
Did some more testing. Tried doing navigation.replace, didn't work. Seems like we need some way to override the following:
const onDismiss = React.useCallback(() => {
// BottomSheetModal will call onDismiss on unmount, be we do not want that since
// we already popped the screen.
if (isMounted.current) {
navigation.goBack();
}
}, [navigation]);
Maybe an exit all modals function.