Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

153
Vistas
React Native Stack Navigation Hopping Multiple Pages

I am building a react native app and I'm quite confused about how the page navigation is occurring. I seem to have a problem where my navigation is skipping a page.

<NavigationContainer>
      
      <Stack.Navigator initialRouteName="Home">
        <Stack.Screen 
          component={HomeScreen}
          name="Home"
        />
        <Stack.Screen 
          component={FirstScreen}
          name="First"
        />
         <Stack.Screen 
          component={AssignWorkoutScreen}
          name="Third"
        />

        <Stack.Screen 
          component={SecondScreen}
          name="Second"
        />
      </Stack.Navigator>
    </NavigationContainer>

My goal is to achieve the following navigation I want to go from home -> First Screen -> 2nd Screen. However, I run into the issue that when I click the first screen it immediately jumps the first screen to the second one.

Code for Home:

class HomeScreen extends React.Component {
    render() { 
        return (
          <View>
            <Button
              title="First"
              onPress={() => this.props.navigation.push("First")}
            />
            
          </View>
        );
    }
}

Code for First Screen:

class FirstScreen extends React.Component {
  render() {
    return (
        <ScreenContainer>
        ...
            <Button
            title='hey'
            onPress={this.props.navigation.navigate("Second")}/>
        ...

      </ScreenContainer>
 
    );
  }
}

Thank you for all your help!
about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

You are calling the function in the onPress handler instead of passing it a reference to call later.

 <Button
   title='hey'
   onPress={this.props.navigation.navigate("Second")}/>

To This

 <Button
    title='hey'
    onPress={() => this.props.navigation.navigate("Second")}/>
about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda