React Navigation is a popular library used with React Native for navigation. It helps us to build navigational apps. Here is a quick guide for impl...
For further actions, you may consider blocking this person and/or reporting abuse
should i install its dependencies?
when i try to install dependencies by this command :
npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view
i get error
Hey @rozzz333 ,
Are you trying to install it in a new project or in an existing one? Also it might help if you could share the error you're getting.
I don't understand: Is your Home Screen component in a separate
.js
file? If so, don't you need toimport App from './App'
so you can use the stack navigator exported fromApp.js
??????????????? Why is this so impossible?? I simply want to navigate between.js
files!!!EDIT: Oh...you're navigating from
App.js
toHome.js
...What if I want to navigate back fromHome.js
toApp.js
?? (What if I want the navigation stack accessible in different.js
files???)How can we use class in react-navigation-5?
Hey Hardik,
Were you able to get it working? Do you want me to write a blog post for this? Please let me know how I can help you.
yes please make a blog post of react navigation 5 using class components ....if already have blog ....please give link
Hey @Techie,
I started writing the blog for it, but later realized that it is similar to the way we did with the previous versions, except for a few minor changes ofcourse. If you need help with that, I'll try to complete is soon, and share the link with you.
Hi Harshil, I was able to make it work. But a detailed blog will help many developers as no material is available for navigation 5.0.
Thanks Harshil, that's really helpful. How would you handled setParams to make the header dynamic?
Hi! I'm not the OP, but I've made the header dynamic by passing to the Home.navigationOptions function the navigation parameter like so:
This should work based on the React Navigation doc (reactnavigation.org/docs/en/header...).
Last but not least, I'm completely new to React Native, so take my answer with a grain of salt :)
Thanks @corsal8 , not quite what I meant: if you look on the same react-native doc it's the setParam function I'm trying to use. Not sure of the syntax when using it in a functional component compared to the class component that the docs exemplify :)
Hey kiwipedro I am glad that the article could help. To use the setParams() method the structure is similar to navigate() method as shown in the article above,
navigation.setParams({...})
Thanks mate! I just started converting a small app from class to function components, hit this very obstacle, and fortunately your post got me going again.
Thank you for reading it! I am happy that this could help you. 😄
This is super Thank You Bro.