0

Actualice la version de react navigator, especificamente de la vercion "react-navigation": "^3.11.1", a la versión "@react-navigation/native": "^5.1.7", ahora al querer utilizar:

 static getDerivedStateFromProps(props, state) {
if (props.navigation && props.isLogged) {
  props.navigation.navigate('Main');
}
return null; }

Se que el props.navigation.navigate(); es de la versión antigua... que función, ¿puedo utilizar que remplace props.navigation.navigate();, pero que haga la misma funcionalidad?

1 respuesta 1

0

El problema siempre fue que nunca se heredaba la propiedad navigation. Al no seer una función, nunca pude heredarle las propiedades de navigation, así que lo solucione incluyendo la pantalla en en el <Stack.Navigator> así:

<NavigationContainer>
      <Stack.Navigator initialRouteName="Loading">
        <Stack.Screen
          name="Loading"
          component={AuthLoading}
          options={{ headerShown: false, gesturesEnabled: false }}
        />
        <Stack.Screen
          name="Login"
          component={LoadingView}
          options={{ headerShown: false, gesturesEnabled: false }}
        />
        <Stack.Screen
          name="Navigation"
          component={NewsStack}
          options={{ headerShown: false, gesturesEnabled: false }}
        />
      </Stack.Navigator>
</NavigationContainer>

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.