I'm building an app using react-native and stack navigators, and tab navigators. Screens never unmounts when navigating. I want to unmount the screens when a user press a 'logout' button, so when a new user logs in all screens need to be mounted again without old state preservation.
How can I do this?
Using this.props.navigation.popToTop()
inside a screen does not work.
My current navigators structure:
App DrawerNavigator -> OnBoard Drawer Navigator --> (SignIn screen, SignUp screen)
-> Logged Drawer Navigaror --> Home Tab Navigator
--> Settings Stack Navigator -->(Settings screen)
I'm calling the logout function inside the Settings screen.