0

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' }],
});
2
  • can you share your navigation stack how you structured it? So it's easy to identify. Commented Nov 30, 2021 at 12:39
  • There is no any logic in my code for navigation. I am navigating with just a condition based on boolean value, either true or false. So if I try to navigate with navigation.navigate then it does not work, but when I use navigation.reset, then it works perfectly! Commented Dec 5, 2021 at 20:01

1 Answer 1

1

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

And declare your home screen in App navigator or auth navigator

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.