It has only been developed on Mac. However Windows and Linux should work
See the wiki, https://github.com/grimmer0125/maolife/wiki
Android store (beta): https://play.google.com/store/apps/details?id=com.lifeoverflow.maolife
iOS: https://itunes.apple.com/us/app/maolife/id1397714182
It mainly uses https://nativebase.io/.
The development was setup on 10.12 and has been upgraded to 10.13 with Xcode 9 and latest React version. 10.12 & 10.11 is not tested for the latest code.
- macOS: 10.13.5 (High Sierra)
- Xcode: 9.4 (Its version may affect the versions about React Native and some native npm library)
- Android Studio: 3.1
- Gradle version: 4.1
- Android Gradle plugin version: 3.0.1
- React Native: 0.55.4 (from v0.49, a breaking change is, there is no more index.Android.js and index.iOS.js, only index.js)
- React: 16.3.1 (Its version will affect - native-base and react-navigation)
- native-base: 2.4.5
- react-navigation: 2.0.4.
- react-native-fbsdk: 0.7.0
- FacebookSDK-iOS (need manually download): 4.33.0
- FacebookSDK-Android: 4.33.0
- Python: 2.7 (Some native npm libraries need Python to build)
ref: https://Firebase.google.com/docs/web/setup
- Create a Firebase project in the Firebase console
- Authentication -> Enable Facebook. Then record Oauth redirect URI for the following Facebook setting.
- Click Add Firebase to your web app to get its config information.
- Create a project, then choose Realtime Database.
- Enable Facebook & Email login in Authentication.
- Change Database rule as the following
{ "rules": { ".read": "auth != null", ".write": "auth != null", "users":{ ".indexOn":["KID"] } } }
```
apiKey: "<API_KEY>",
authDomain: "<PROJECT_ID>.Firebaseapp.com",
databaseURL: "https://<DATABASE_NAME>.Firebaseio.com",
storageBucket: "<BUCKET>.appspot.com",
messagingSenderId: "<SENDER_ID>",
```
Node 10 can not be used since one of dependent package, grpc will fail to install
It seems that firebae 5.0.4 will let Android built app can not start (Objects are not valid as a React child) but "debug JS remotely" works
It seems that if Android Gradle upgrades to 3.1.3 from 3.0.1 and gradle to 4.4 from 4.1, Android Studio will fail to build. (react-native run-android is OK)
Reference: https://facebook.github.io/react-native/docs/getting-started.html
Summary Step:
- install homebrew from https://brew.sh. (terminal:
type brew
to check if you have) - brew install node (or you can install Node from https://nodejs.org/en/, in your terminal, type
node --version
to check your version, should use Node 8 or newer) - brew install watchman
- npm install -g react-native-cli
- install Xcode 9 and its command line tools, follow https://facebook.github.io/react-native/docs/getting-started.html#xcode
- git clone this project, https://github.com/grimmer0125/Kiteretsu
- cd into this project folder,
npm install
- (optional)
node node_modules/native-base/ejectTheme.js
(native-base) react-native link
(required by native-base, react-native-vector-icons, react-native-fbsdk, react-native-svg)
ref: https://developers.facebook.com/docs/ios/getting-started/#download
Download Facebook SDK and uncompress it to ~/Documents/FacebookSDK
(optional) Config Facebook project on Facebook site and iOS project if you are not using this project's Facebook application settings
Follow this guide: https://developers.facebook.com/docs/react-native/configure-ios
Keypoint:
- On https://developers.facebook.com/, after adding Facebook login in your Facebook Application, you need to setup OAuth Redirect URI gotten from Firebase.
- in project folder,
npm run ios
orreact-native run-ios
.
Steps: https://facebook.github.io/react-native/docs/running-on-device.html
Start from xcode 7, no need paid developer account to run on real device !! Guide: http://blog.ionic.io/deploying-to-a-device-without-an-apple-developer-account/
Keypoint to setup Facebook:
- Follow https://developers.facebook.com/docs/react-native/configure-android-current
- Need a development key hash for the development environment of each person who works on your app (cover in 1.). Release key is needed, too. (This release key is to authorize to use Facebook, not Android release key)
- Enable single sign https://developers.facebook.com/docs/facebook-login/android/#expresslogin
Only the Facebook accounts which are registered on Facebook developer site can login successfully.
You need to launch your Android emulator (Android Virtual Device) first, then npm run android
to install and run. The default React Native command will not launch Android emulator automatically.
You can use the following ways to launch emulators
- Android Studio
- In terminal, type
emulator @YOUR_VIRTUAL_DEIVCE
& or change the VIRTUAL_DEIVCE name innpm script (qemu)
then you can typenpm run qemu
in start your emuator..
It is possible to directly use Android Studio to launch and debug. In this case, you may encounter Unable to load script from assets 'index.android.bundle'
, the relative discussion: https://stackoverflow.com/questions/44446523/unable-to-load-script-from-assets-index-android-bundle-on-windows/47035389.
Follow https://facebook.github.io/react-native/docs/debugging.html to have remote JS debugging. You can setup breakpoint on Nuclide or chrome debugger.
- Use Nuclide's "React Native Inspector".
- Use https://github.com/jhen0409/react-native-debugger. (which also includes redux-devtoolsy). p.s. And you can not use it to debug react widget and use http://localhost:8081/debugger-ui to see JavaScript logs at the same time.
- Standalone react-devtools
https://github.com/zalmoxisus/remote-redux-devtools supplies a way to use redux server to get redux'store. It needs
!! [201806 update] Just use react-native-debugger and it works. The code already set up the according redux store part (same setting as remote-redux-devtools) !!
!! [201712 update] remote-redux-devtools-on-debugger is not compatible with the latest React v0.51 and is removed from this project !!
modify your code. follow https://github.com/zalmoxisus/remote-redux-devtools or https://github.com/jhen0409/remote-redux-devtools-on-debugger to setup. I tried the latter'sremote-redux-devtools
's setting and used its local redux server and integrated react debugging for react native.prepare a local redux server (localhost) or a WAN remote server.Then just use browser to see the redux'store (http://localhost:8000) or use specific web page/app to Redux's store.
You can use remote-redux-devtools
' guide to prepare your own local server.
Or follow https://github.com/jhen0409/remote-redux-devtools-on-debugger to cover the above 1~3. It comes with a local redux server and also integrates redux with react debugger page. So just use http://localhost:8081/debugger-ui to see React's log and Redux's store at the same time.
offline
means you can run this app without any dev servers/environment/Mac.
- Choose maolife-release scheme.
- Connect your iPhone to Mac.
- Build
possible step: only extra run npm run ios-offline-jsbundle
before build step if you see main.jsbundle does not exist
and build fail.
- connect your Android device to Mac.
- use
npm run android-release
to build
possible step: only extra run npm run android-offline-jsbundle
before build step if you see unable to load script from assets 'index.android bundle'
and build fail.
iOS:
- Choose maolife-release scheme.
- Product -> Archive
Android
- cd android
- ./gradlew assembleRelease