2017 - budapest.mobile meetup @ Budapest
I have been an android developer for 5 years now. Beginning of this year I stepped out from my comfort-zone, and tried out React-Native.
After releasing 4 different kind of RN projects, I would like to share my experience and give you some tips so you won't feel like you are fighting for your life when using RN on Android or ios. So what is my "survival kit" contains? A lot of info on project structure and setup, libraries, tools for debugging, best-practices, fastlane, push notifications and much more.
2. We experiment, we move fast,
we make it happen
At Supercharge we build high-impact mobile products making life easier for millions of users. Creating
stunning experiences can only happen if you stretch yourself. To supercharge means to go that extra
mile.
8. yarn add redux
‣ Plan redux store
‣ reselect
‣ https://github.com/reactjs/reselect
‣ redux-batched-actions
‣ https://github.com/tshelburne/redux-batched-actions
Supercharge 8
9. yarn add react-navigation
‣ Redux integration
‣ https://github.com/react-community/react-navigation/blob/master/docs/guides/Redux-
Integration.md
‣ Keep in mind that when a navigator is given a navigation prop, it relinquishes control of its
internal state. That means you are now responsible for persisting its state, handling any
deep linking, Handling the Hardware Back Button in Android, etc.
‣ Replace a screen when navigate
‣ https://medium.com/handlebar-labs/replace-a-screen-using-react-navigation-
a503eab207eb
Supercharge 9
10. yarn add react-native-offline
Supercharge 10
‣ Reducer to keep your connectivity state in the Redux store
‣ Redux middleware to intercept internet request actions in offline mode and apply DRY
principle
‣ A step further than NetInfo detecting internet access besides network connectivity
11. Avoid react-native link
‣ Sometimes fails (duplicated packages)
‣ Lifesaver if you know, how it works
‣ Android: Gradle
‣ iOS: Cocoapods support from React Native 0.50
Supercharge 11
12. yarn add patch-package --dev
‣ https://github.com/ds300/patch-package
‣ Lets app authors instantly make and keep fixes to npm dependencies
‣ No more forking repos just to fix that one tiny thing preventing your app from
working.
Supercharge 12
# fix a bug in one of your dependencies
vim node_modules/some-package/brokenFile.js
# run patch-package to create a .patch file
patch-package some-package
# commit the patch file to share the fix with your team
git add patches/some-package+3.14.15.patch
git commit -m "fix brokenFile.js in some-package"
22. Flavors and schemes and signings
‣ iOS Build Configurations and Android Build Variants
‣ https://medium.com/@ywongcode/building-multiple-versions-of-a-react-native-app-
4361252ddde5
‣ Must solve it natively
‣ Learn the following definitions:
‣ iOS: keychain access, signing identity, auth key, (wildcard) app id, device udid,
provisioning profile, development/distribution certificate, development/ad-
hoc/appstore profile, developer portal != itunes connect,
‣ Android: debug/release keystore, (upload and signing key!)
Supercharge 22
23. yarn add react-native-config
‣ Expose config variables to javascript code in React Native, supporting both iOS and Android
‣ Android: dotenv.gradle
‣ iOS: BuildDotenvConfig.ruby
‣ Supports flavors and schemes
‣ Recompile needed
‣ A babel plugin for react-native-config to avoid clean/rebuild for javascript config changes
‣ https://github.com/j2kun/babel-plugin-react-native-config
Supercharge 23
24. yarn add react-native-schemes-manager --dev
Supercharge 24
react-native/scripts/react-native-xcode.sh
. . .
case "$CONFIGURATION" in*Debug*)
if [[ "$PLATFORM_NAME" == *simulator ]]; then
. . .
. . .
if [[ "$CONFIGURATION" = "Debug" && ! "$PLATFORM_NAME" == *simulator ]]; then
PLISTBUDDY='/usr/libexec/PlistBuddy'
PLIST=$TARGET_BUILD_DIR/$INFOPLIST_PATH
. . .
‣ Swap its own version of react-native-xcode.sh in instead of the stock one that assumes all
debug schemes are named 'Debug'.
‣ Add your build configurations to all library Xcode projects.
‣ Hide any schemes that come from your library projects so they don't show up in the me