Programming navigation React Navigation

Asked

Viewed 23 times

0

Is there any way to do programmatic navigation using lib @React-navigation in React Native?

I am validating outside the React files . JSX and wanted to "push" a route if any conditions are met

  • If you pass the object history for this function, can use history.push. I don’t know if this logic makes sense, I think taking navigation from the component can hinder the understanding of the code, since an external function would be modifying the state of the application.

  • Hook useNavigation would not help?

1 answer

0

I was able to solve using a Navigation Container reference from React Navigation as per documentation and inside the function outside the component calling this reference.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.