react-native-react-bridge
react-native-react-bridge copied to clipboard
React-native-web support
Hello,
First of all thank you for this package, it's really clever and helpful.
I was wondering if it would be hard to add react-native-web support in it ?
For a quick context on why it would be awesome, we are using react-native and react-native-web and allowing react-native-web inside would allow us for example to reuse all of our already made components inside the webview
That sounds interesting.
If rnrb.preact is true, this library converts react imports to preact imports here:
https://github.com/inokawa/react-native-react-bridge/blob/4d9a19b2ca119c42ab97a1ebbaba9ae468f33eb0/src/plugin/transformer.js#L16C20-L34
I'm not sure what level of support is the best, but adding rnrb.reactNativeWeb like option and converting react-native imports under web entry to react-native-web may work as you expected.
Will try it at my work and if it works will make a pull request for it, thanks for the headups ! 👍
That sounds interesting.
If
rnrb.preactis true, this library converts react imports to preact imports here: https://github.com/inokawa/react-native-react-bridge/blob/4d9a19b2ca119c42ab97a1ebbaba9ae468f33eb0/src/plugin/transformer.js#L16C20-L34I'm not sure what level of support is the best, but adding
rnrb.reactNativeWeblike option and convertingreact-nativeimports under web entry toreact-native-webmay work as you expected.
Any Update on this i am trying to get react-native-web to work via the above suggestion but no luck so far
Just got it to work by using import "react-native-web" directly from the webapp.js file