Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
React navigator not moving between screens

My app closes when I press the switch screen button. I don't see any error output. I did a version check and there was no problem.

The function I wrote for the button works

Router.js

import React from "react";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import First from "./First";
import Second from "./Second";
const Stack = createNativeStackNavigator();

const Router = () =>{
    return(
        <NavigationContainer>
            <Stack.Navigator initialRouteName="First">
                <Stack.Screen name="First" component={ First }/>
                <Stack.Screen name="Second" component={ Second }/>
            </Stack.Navigator>
        </NavigationContainer>
    );
}

export default Router;

First.js

import React from 'react';
import {View,Text,Button} from 'react-native';


const First = ( props ) =>{
    const gotoSecond = () => {
        console.log("First");
        props.navigation.navigate("Second");
        console.log("second")
    }
    return (
        <View>
            <Text>Hello First Page!</Text>
            <Button title="Go SecondPage!" onPress={gotoSecond}/>
        </View>
    );

};

export default First;

Second.js

import React from 'react';
import {View,Text} from 'react-native';

const Second = () =>{
    return (
        <View>
            <Text>Hello Second Page!</Text>
        </View>
    );

};

export default Second;

OS:Android, Emulator:Genymotion.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Now I'm using ADV instead of Genymotion, problem solved.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!