Home > Back-end >  React Native navigation doesn't render component after changing the route
React Native navigation doesn't render component after changing the route

Time:09-15

I created this enter image description here

After clicking on go to about page:

enter image description here

CodePudding user response:

try importing the navigation from props as the following and retest:

export function Home({navigation}) {
  return (
    <View style={styles.container}>
      <Text>Welcome!</Text>

      <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
        <Text>Home Screen</Text>
        <Button
          title="Go to About"
          onPress={() => {
            navigation.navigate('About')
          }}
        />
      </View>
    </View>
  );
}

And if this doesn't solve your problem or that's how you already have done it but didn't write all the code then please show all your code, as well as the About screen code

  • Related