Mohammad Fareed Alam
Mohammad Fareed Alam

Reputation: 139

React Native - navigation.navigate is not working

I am a newbie in react native, I am facing some worst kind of behavior of react native. For example, if I try to navigate the user with navigation.navigate, it does not work, but when I try to navigate with navigation.reset, then it navigates the user. Can someone please explain it? I saw some questions here similar to my question but the answers there did not satisfy me. Thanks for your time.

The navigation.navigate which did not work is

navigation.navigate('Home');

The reset function which worked is

navigation.reset({
  index: 0,
  routes: [{ name: 'Home' }],
});

Upvotes: 0

Views: 1673

Answers (1)

Apps Maven
Apps Maven

Reputation: 1420

Try this.props.navigation.navigate('Home')

And declare your home screen in App navigator or auth navigator

Upvotes: 1

Related Questions