react-router-native icon indicating copy to clipboard operation
react-router-native copied to clipboard

compatibility react-native-web ?

Open flyjennyetn opened this issue 8 years ago • 5 comments

compatibility react-native-web ?

flyjennyetn avatar Dec 22 '16 07:12 flyjennyetn

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 avatar Dec 22 '16 15:12 chandlervdw

@chandlervdw There are examples?

flyjennyetn avatar Dec 23 '16 02:12 flyjennyetn

@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 avatar Dec 23 '16 18:12 nicholeuf

@nicholeuf thanks a lot

flyjennyetn avatar Dec 26 '16 01:12 flyjennyetn

@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.

VinceBT avatar Dec 29 '16 13:12 VinceBT