7kfpun / FinanceReactNative

[Deprecated] iOS's Stocks App clone written in React Native for demo purpose (available both iOS and Android).
https://play.google.com/store/apps/details?id=com.kfpun.finance
MIT License
2.06k stars 630 forks source link

I tried adding a web build --what do you think of this idea? #23

Open iambumblehead opened 7 years ago

iambumblehead commented 7 years ago

I cloned FinanceReactNative then followed this guide to add a web build using react-native-web, alongside the android and ios builds.

When I tried to build the web version, many errors like these are printed by web pack

ERROR in ./~/react-native/Libraries/react-native/react-native.js
Module not found: Error: Cannot resolve module 'Clipboard' in /home/chris/software/FinanceReactNative/node_modules/react-native/Libraries/react-native
 @ ./~/react-native/Libraries/react-native/react-native.js 81:27-47

ERROR in ./~/react-native/Libraries/react-native/react-native.js
Module not found: Error: Cannot resolve module 'DatePickerAndroid' in /home/chris/software/FinanceReactNative/node_modules/react-native/Libraries/react-native
 @ ./~/react-native/Libraries/react-native/react-native.js 82:35-63

Do you think a web build for FinanceReactNative is feasable/desirable? I do not know if a web build is possible. What do you think?

7kfpun commented 7 years ago

I was thinking about adding web support long time ago. I think it's nice and possible to do so as I did very little linking to native module. But you may have to deal with react-native-vector-icons a little bit. https://github.com/oblador/react-native-vector-icons#web-with-webpack

iambumblehead commented 7 years ago

I could push the additions that I made to a new branch here or to a clone using my profile. Would you welcome the creation of such a branch?

7kfpun commented 7 years ago

Yes you could folk it first and make a pull request. But keep in mind to keep to code clean.

iambumblehead commented 7 years ago

@7kfpun I've made a new branch here named add-react-native-web. It does not build all the way, due to errors like these:

ERROR in ./~/react-native/Libraries/react-native/react-native.js
Module not found: Error: Cannot resolve module 'RCTDeviceEventEmitter' in /home/chris/software/FinanceReactNative/node_modules/react-native/Libraries/react-native
 @ ./~/react-native/Libraries/react-native/react-native.js 109:36-68

ERROR in ./~/react-native/Libraries/react-native/react-native.js
Module not found: Error: Cannot resolve module 'RCTNativeAppEventEmitter' in /home/chris/software/FinanceReactNative/node_modules/react-native/Libraries/react-native
 @ ./~/react-native/Libraries/react-native/react-native.js 110:39-74

similar errors are described in these react-native-web tickets, where the author replies "[...] react native internals you won't be able to use them on web"

Do you have advice or thoughts towards preparing a web build of Finance React Native?

clone and build my branch to see the errors I'm seeing

$ git clone https://github.com/iambumblehead/FinanceReactNative.git
$ cd FinanceReactNative
$ git checkout add-react-native-web
$ npm install
$ npm run web-dev