Need to reuse the react-navigation
code from mobile to react-native-web
. But I could not able to get it work in web.
Should we need to use react-router
for web separately?
How can we configure navigation commonly for both platform? I would love to see an example of this! It would be super helpful. Thank you!!
"React Native for Web" makes it possible to run React Native components and APIs on the web using React DOM. This approach allows you to reuse most of React Navigation on the web because React Native for Web maps React Native primitives like View , Text , and others to their equivalents on the web.
react-native-navigation: uses the underlying native APIs on iOS and Android, similar to createNativeStackNavigator. This is a popular alternative to React Navigation and may be a better fit for you if you are trying to integrate React Native into an existing large native app.
Maybe you can check this implementation
Using React Native, React Native Web and React Navigation in a single project
The above answers are quite old now I'd say as react-navigation has upgraded itself quite a bit since then.
react-navigation v4 has intensive support for react native web, now you don't need to maintain two separate navigation objects for web and app.
This blog explains it in detail. https://codersera.com/blog/how-to-do-navigation-in-react-native-web-in-2020/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With