jmurzy/react-router-native

compatibility react-native-web ?

flyjennyetn opened this issue · 5 comments

compatibility react-native-web ?

Yes. We're still working through lots of issues, but they don't necessarily pertain to react-native-web's ability to render web components. We are using two different routers, one for native (router/index.js) and one for web (router/index.web.js).

@chandlervdw There are examples?

@flyjennyetn We are following the example from react-native-web here using webpack aliases. The shared code imports from react-router-native and react-native. We have two router files for generating the routes for each platform since native uses different constructs (nativeHistory, TabsRoute, and StackRoute). Other than that, Link, withRouter, Routes etc are identical, for the most part, thanks to the goal of API parity with react-router.

Our webpack config looks something like this:

resolve: {
    alias: {
      'react-native': 'react-native-web',
      'react-router-native': 'react-router'
    },
  },

@nicholeuf thanks a lot

@nicholeuf Could you give us an exemple of routes for ReactRouter and ReactRouterNative ? I have some problems with all the TabsRoute, StackRoute and IndexRoutes that are not allowed.