Skip to content

React Native

ΖΛΚ edited this page Mar 19, 2018 · 5 revisions

Running the project using terminal

iOS

react-native run-ios

Android

react-native run-android

Issue running the project?

  1. rm -rf node_modules
  2. Delete package-lock.json or yarn.lock
  3. npm install or yarn install
  4. react-native link
  5. npm start -- --reset-cache
  6. react-native run-ios or react-native run-android

Running the project on Xcode

  1. npm run build:ios
  2. Drag the main.jsbundle file into Xcode from <project-name>/ios/<project-name>/main.jsbundle
  3. Run the project using Xcode build button.

Running the project on Android Studio

  1. Open the <project-name>/android folder using Android Studio
  2. Run the project using Android Studio build cmd and select the emulator you wish.

Upgrading react native

  1. Delete ios/ and android/
  2. react-native eject
  3. npm install -g react-native-git-upgrade // if this package is not installed
  4. react-native-git-upgrade
  5. react-native link
  6. react-native run-ios

Add/Update App icons on a single command line for both iOS & Android

  1. npm install -g yo generator-rn-toolbox
  2. brew install imagemagick
  3. yo rn-toolbox:assets --icon <image-directory>
  4. You will be asked for the name of your react-native project, Project name is <project-name>
  5. When you are asked: ? Overwrite ios/<project-name>/Images.xcassets/AppIcon.app iconset/Contents.json? replay with y

For more information check here: https://github.com/bamlab/generator-rn-toolbox/blob/master/generators/assets/README.md