Skip to content

Instantly share code, notes, and snippets.

@gopalakrishnan-subramani
Last active December 24, 2018 03:43
Show Gist options
  • Save gopalakrishnan-subramani/621c419490caaf8a4aaeadc2d222d85a to your computer and use it in GitHub Desktop.
Save gopalakrishnan-subramani/621c419490caaf8a4aaeadc2d222d85a to your computer and use it in GitHub Desktop.
React Native

System Requirements

  1. Windows/Mac/Linux Desktop
  2. At least 8 GB RAM, 12 GB preferred
  3. i5 or i7 processor
  4. 50 GB Space in the Harddrive
  5. Android/iOS Mobile phone for Expo App
  6. Virtualization to be enabled in the BIOS for Emulators

Software Requirements

Node.js

  • Install Node.js 8.12. Ensure that we have Node.js 8.x not lower or higher

Node.js Tools

Install below node.js tools for React Native Development

Environment Variables

  1. Set JAVA_HOME to JDK 1.8 directory
  2. Set ANDROID_HOME as per Android Studio SDK Location

Expo Cli

Expo cli doesn't need Java, JDK, SDK, XCode and other tools. It just works with your mobile phone. Ensure that your laptop and mobile phone connected to same WIFI network for same.

Install Expo App from Google Play Store or from App Store for iOS

npm install yarn -g

npm install -g expo-cli



Create Project using Expo

expo init ReactApp

cd ReactApp

npm start 

To run on Android emulator, but you should be running emulator in the machine.

npm run android

Create Project using React Native Cli*

npm install -g react-native-cli

React-Native-Cli needs Android SDK, JDK and other development tools.

with latest React-Native release (as on Dec 2018, 0.56/0.57), has bug with Windows OS and also few issues with Mac with iOS project template Do not use if you are working with Windows.

to create the app specific to React native version, use this command

  react-native init --version="react-native@0.55.4" ReactApp
  
  
 cd ReactApp

 react-native run-ios

 react-native run-android

Clean up

rm -rf ~/.rncache

when shakking not working

adb shell input keyevent KEYCODE_MENU

Troubleshooting

  1. Clear watchman watches: watchman watch-del-all.
  2. Delete the node_modules folder: rm -rf node_modules && npm install.
  3. Reset Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache.
  4. Remove haste cache: rm -rf /tmp/haste-map-react-native-packager-*.

iOS build issues

rm -rf node_modules/ && yarn cache clean && yarn install node_modules/react-native/scripts/ios-install-third-party.sh

Commands

yarn add redux react-redux redux-thunk

yarn add react-navigation

yarn add react-native-gesture-handler

react-native link react-native-gesture-handler

yarn add redux redux-thunk react-redux

yarn add react-native-vector-icons

react-native link react-native-vector-icons

Refer for Android Source code update

https://reactnavigation.org/docs/en/getting-started.html

XCode 10 issues

facebook/react-native#21168

sed -i '' '/DevelopmentTeam = V9WTTPBFK9/d;/DEVELOPMENT_TEAM/d;/ProvisioningStyle = Automatic/d' ./node_modules/react-native/React/React.xcodeproj/project.pbxproj

Other React Native .57 issues

facebook/react-native#21490

Clean cache

rm -rf $TMPDIR/react-*; rm -rf $TMPDIR/haste-*; rm -rf $TMPDIR/metro-*; watchman watch-del-all

Open a new tab and Start Metro Bundler directly from the project folder

react-native start  --reset-cache

Now run react-native run-android or react-native run-ios

https://stackoverflow.com/questions/37461703/print-entry-cfbundleidentifier-does-not-exist

For config.h not found error

cd node_modules/react-native/third-party/glog-0.3.4

./configure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment