I have this screen where it is accessed only if i login successfully, even after login i am getting this error message."The action 'NAVIGATE' with payload {"name":"Choose"} was not handled by any navigator. Do you have a screen named 'Choose'?"
app.routes.tsx
export function StackRoutes() { const { Navigator, Screen } = createNativeStackNavigator(); return (<Navigator screenOptions={{headerShown: false}} initialRouteName="Choose"><Screen name="Choose" component={Choose} /> <Screen name="Student" component={Student} /> <Screen name="Leave" component={AuthRoutes} /></Navigator> )
auth.routes.tsx
export function AuthRoutes() { const { Navigator, Screen } = createNativeStackNavigator(); return (<Navigator screenOptions={{headerShown: false}} initialRouteName="Login"><Screen name='Login' component={Login} /></Navigator> )}
on the login screen I have the function and trycatch:
setLoading(true); try { const schema = Yup.object().shape({ username: Yup.string() .required('Código é obrigatório'), password: Yup.string() .required('A senha é obrigatória') }); await schema.validate({username, password}); await login({username, password}); navegation.dispatch(CommonActions.navigate('Choose'));auth.routes.tsx export function AuthRoutes() { const { Navigator, Screen } = createNativeStackNavigator(); return (<Navigator screenOptions={{headerShown: false}} initialRouteName="Login"><Screen name='Login' component={Login} /></Navigator> )