I have been using React navigation v4 since I am coding in react native. Recently I switched to v6 in a new project, when I needed to setup switchNavigation as I have in v4, I found there was no proper documentation on their site. I tried few ways but it couldn't get me to the desired result. Did anyone of you guys has their setup in v6 of switchNavigation? If so, do share and help me out.
Use async storage , Context APIenter code here
<NavigationContainer theme={MyTheme}>
<Stack.Navigator
screenOptions={{
headerShown: false,
presentation: 'card',
}}
initialRouteName="Landing" //TODO: change to Landing or comment it ;)
// detachInactiveScreens={true}
>
{props.shared.isloginHost == null ? (
<>
<Stack.Screen name="Landing" component={Landing} />
<Stack.Screen name="SignIn" component={SignIn} />
<Stack.Screen name="SignUp" component={SignUp} />
<Stack.Screen name="SignUpDetails" component={SignUpDetails} />
<Stack.Screen name="ForgotPassword" component={ForgotPassword} />
<Stack.Screen name="OTPPassword" component={OTPPassword} />
<Stack.Screen name="ChangePassword" component={ChangePassword} />
<Stack.Screen
name="GuestBottomTab"
component={GuestBottomTabs}
/>
</>
) : (
<>
{props.shared.isloginHost == false ? (
<Stack.Screen
name="GuestBottomTabs"
component={GuestBottomTabs}
/>
) : (
<>
{props.shared.hostplan == null ? (
<Stack.Screen name="Insight" component={Insight} />
) : null}
<Stack.Screen
name="HostBottomTabs"
component={HostBottomTabs}
/>
</>
)}
</>
)}
props.shared.isloginHost isloginHost is the state in the shared reducer when the state is null then user only access the Auth screen