Sample iOS application using React Native
- install Homebrew if on Mac
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- install node (React Native Docs Reccomend using chocolately to insatall windows deps docs)
- install watchman (again only for mac)
- now install the react-native-cli
npm install react-native-cli
- make sure to have Java updated and that Xcode and Android studio are up to date
- when testing on Android making sure to to open
android/
in android studio is and have it auto fix any dep errors makes setting up easy - when running android command make sure to have the simulator up and running before running the command from the command line
- to run ios
react-native run-ios
- you can pass the simulator flag to choose different devices
- example :
react-native run-ios --simulator='iPad Pro (9.7 inch)'
- to run android
react-native run-android
- If
android
is not working from the commandlinevim ~/.bash_profile
export ANDROID_HOME=/Users/i/Android\ SDK # !!! Change this configuration path. I install Android SDK in my local Mac directory.
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
- You cannot build to IOS from a windows env
- If you run into issues with packages getting resolved improperly run the packager as follows from the command line
./node_modules/react-native/packager/packager.sh --reset-cache
- If the orientation package is causing problems in android you may have to manually setup the package in android studio here is a link for reference
- also note in the package.json that it is point to the github repo for pulling it down because the package has not been updated on npm to reflect the current branch.
- right now the setup is pretty focused on IOS and slightly tailored to the IPAD layout entry
#!/bin/bash
# make sure to update xcode
#install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
#install node
brew install node
#install watchman
brew install watchman
#install the react native cli
npm install -g react-native-cli
#install java and jdk if you don't have it
brew cask install java
#install platform tools
brew install android-platform-tools
#NOTE Make sure to have Android studio up and have an AVD device running for adb to connect to