Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

React Native 'NAVIGATE' with payload error

$
0
0

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>      )

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>