I want to launch SplashScreen
, for every App launch where I'll be performing a large number of tasks. Once this is done, I'll navigate to AuthScreen
or MainScreen
.
Since there is no SwitchNavigator
in V5. How do I achieve the following conditions,
AuthScreen
: When a user clicks the Android hardware back button, he has to exit the App without going back toSplashScreen
.MainScreen
: Same scenario as above, When a user clicks the Android hardware back button, he has to exit the App.
I can place SplashScreen
inside <RootStack.Navigator/>
making SplashScreen as initialRouteName
but it didn't satisfy the above conditions.
Can anyone help me out where should I place the SplashScreen
component in V5?
Here is the AppNavigation.js
file
const RootStackScreen = ({ userStatus }) => {
return (
<RootStack.Navigator headerMode="none">
{userStatus ? (
<RootStack.Screen name="AppDrawerScreen" component={AppDrawerScreen} />
) : (
<RootStack.Screen name="AuthStackScreen" component={AuthStackScreen} />
)}
</RootStack.Navigator>
);
};
const AppContainer = ({ user }) => {
return (
<NavigationContainer>
<RootStackScreen userStatus={user} />
</NavigationContainer>
);
};