React Native Web compatibility
See original GitHub issueIs react-native-web
compatibility planned? It seems that it should be possible to make this library compatible with both react-native
and react-native-web
but some work is necessary.
I was able to make it almost work by using webpack aliases:
react-native
-> react-native-web
react-native-svg
-> svgs
The biggest problem seems to be native only code such as setNativeProps
and platform specific files (horizontal-labeled-bar-chart-component.android.jsand
horizontal-labeled-bar-chart-component.ios.js`).
I was able to hack the code quickly to make it render in a browser, so I think it should not take much effort to solve this properly (although I am not very familiar with the project so can’t tell for sure)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:17 (7 by maintainers)
Top Results From Across the Web
React Native compatibility // React Native for Web
React Native for Web provides compatibility with the vast majority of React Native's JavaScript API. Features deprecated in React Native ...
Read more >The complete guide to React Native for Web - LogRocket Blog
React Native for Web provides browser-compatible equivalents of React Native components. For example, if a <View> is used to render views in ...
Read more >React Native For Web Is What You Need For Your Multiplatform
Yes certainly, React Native, which is a cross-platform app development framework, can also be used to develop web applications. Is React Native ...
Read more >necolas/react-native-web: Cross-platform React UI packages
This is the development monorepo for "React Native for Web" and related projects. Structure .github. Contains workflows used by GitHub Actions. Contains issue ......
Read more >react-native-web - npm
"React Native for Web" makes it possible to run React Native components and APIs on the web using React DOM. Documentation. The documentation ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Elijen Thanks for the tip on
svgs
. I too am usingreact-native-svg-charts
withreact-native-web
. I encountered the samehorizontal-labeled-bar-chart-component
issue, but removed these files from my fork for the time being. Additionally, I was usingcreate-react-app
, but I ejected to manually alter the webpack config.It looks like
setNativeProps
is currently used in only one place:src/animated-path.js
. If this is the only native specific code (excluding the mentioned component) then it seems supportingreact-native-web
out of the box may require minimal changes? Possibly with some code to degrade to a non-native setting when the option isn’t available? I’m not sure either…Anyways, I’m posting here to both express interest in this feature and confirm that I was able to reproduce with the steps listed in the issue.
@JesperLekland Thanks for the great lib, I’m getting good looking charts across both native and web!
@AlexBrasileiro we’ve had good luck using react-native-web. Basically what is going on is you need to pass many of the react-native modules (like react-native-svg) through babel. Here is snipit from our webpack config so you can see what we do (I am only posting the relavent section):
then later on, in the config: