react-navigation-bottom-sheet icon indicating copy to clipboard operation
react-navigation-bottom-sheet copied to clipboard

Closing all open modals.

Open izakfilmalter opened this issue 3 years ago • 1 comments

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.

izakfilmalter avatar Sep 19 '22 12:09 izakfilmalter

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.

izakfilmalter avatar Sep 19 '22 13:09 izakfilmalter