Skip to content

Instantly share code, notes, and snippets.

@baurine
Created September 27, 2016 03:58
Show Gist options
  • Save baurine/0f68e2e21b21ab909f50966403157cee to your computer and use it in GitHub Desktop.
Save baurine/0f68e2e21b21ab909f50966403157cee to your computer and use it in GitHub Desktop.
shell helper for run react-native app
#!/usr/bin/env sh
usage() {
echo "Usage:"
echo " run_app android"
echo " run_app ios"
}
arg=$1
if [ -z "$arg" ]; then
arg="android"
fi
emulator=$(ps aux | grep "emulator" | wc -l)
#echo $emulator
if [ $arg == "android" ]; then
if [ $emulator == "1" ]; then
echo "starting emulator..."
nohup ~/Developments/android-sdk-macosx/tools/emulator @Nexus_4_API_23 &
else
echo "emulator has already run"
fi
react-native run-android
elif [ $arg == "ios" ]; then
react-native run-ios
else
usage
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment