No viable solution for web routing to be found

Our team is trying to get up and running with a real-world app, and we haven’t found any robust and viable routing solution (that works).

There is a project called React Native Router Flux (which builds on top of React Navigation) but we have not been able to get it working in conjunction with state management such as redux. If anyone is interested in this topic and can possibly help, I have sample repository here:

The redux navigation action doesn’t work (if anyone can spot the problem help is appreaciated).

for now you should use react-router for web. you can share a lot of your components and code but react-native navigation libraries do not currently support web very well

Thanks, but it feels like we are almost there!

We could get our app almost working, but whenever we dispatch an action that changes global state it resets the navigation and puts us back on the home screen. So close yet so far :joy:

Actually, I am using @react-navigation/web in my app like this and works like a charm :

import { Platform } from 'react-native';
import { createSwitchNavigator, createAppContainer } from 'react-navigation';
import { createBrowserApp } from '@react-navigation/web';

import HomeScreen from '../screens/HomeScreen';
//import your other pages

const createApp = Platform.select({
	web: config => createBrowserApp(config),
	default: config => createAppContainer(config),
});

export default createApp(
	createSwitchNavigator({
		HomeScreen : {screen: HomeScreen, path: ''},
//etc
	},{
		initialRouteName:'HomeScreen',
	})
);

And just use this component in app.js.

Hope I did not just miss the point :sweat_smile:

1 Like