I'm trying to render a couple of different graphs in my react-native project, with a goal of supporting both iOS and Android. Preferably, I'd like to simply use a framework like https://github.com/esbullington/react-d3, but I'm not sure it can be done since there is no real DOM in react-native. Could one somehow get around this problem and get D3 to work in native, or could a similar result be achieved some other way? I would prefer not having to write native code if at all possible.
Asked
Active
Viewed 3,646 times
1
-
Looks like you can use the WebView with the react-d3 library. http://stackoverflow.com/q/29415615/1349269 – Chris Geirman Nov 12 '15 at 11:44
-
Yeah, though so as well, but seems that WebView is only supported on iOS as of now: https://facebook.github.io/react-native/docs/webview.html. Thanks for the answer though! – Jesper Lugner Nov 12 '15 at 12:26
-
1True, but depending on your timeline, they may add it soon enough to be useful. In the mean time, you can bridge the gap with this... https://github.com/lucasferreira/react-native-webview-android – Chris Geirman Nov 12 '15 at 12:51
-
Quite a small timeline I'm afraid, but that link you gave me might be a solution in the short term. Thanks, I'll give it a go! – Jesper Lugner Nov 12 '15 at 13:05
-
Let me know how it goes. Good luck – Chris Geirman Nov 12 '15 at 13:40
2 Answers
2
You can checkout https://github.com/hswolff/BetterWeather
which was made using d3js

anmolakhilesh
- 1,623
- 15
- 18
1
It looks like that particular library is built specifically for the browser. You should find a library / framework like D3 but built specifically for react native. Here are a few examples:

Croolsby
- 1,416
- 1
- 14
- 14

Nader Dabit
- 52,483
- 13
- 107
- 91
-
Thanks for the links! I'm afraid the react-native-chart seems to be unmanaged, and not updated for android. The other library works only for android. If possible, I'd like a solution where I could keep one single code base. – Jesper Lugner Nov 11 '15 at 17:05
-
Oh, I didn't realize that one wasn't being maintained! Here is another, but not very robust: https://github.com/PrazAs/react-native-charts . – Nader Dabit Nov 11 '15 at 17:12