Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save WendySanarwanto/0084b0379de059d59321e1c0d917d0b4 to your computer and use it in GitHub Desktop.
Save WendySanarwanto/0084b0379de059d59321e1c0d917d0b4 to your computer and use it in GitHub Desktop.
HOW TO - Creating a new React Native Android and iOS projects

HOW TO - Creating a new React Native Android project

Pre-requisites

  1. Ensure that you have installed latest version of Android Studio and also setup required environment variables as well.
  2. Ensure that you have installed latest version of react-native-cli

The steps

  1. Run react-native init <yourprojectname> command for creatint a new React Native project. Most likely, you will get this error Error: Command failed: yarn add react@16.8.3 in Windows OS.
  2. Change current directory to your project's directory.
  3. Run yarn add react command.
  4. Run rm -rf ios android command for deleting the existing ios and android folder.
  5. Run react-native eject command.
  6. Run your android emulator.
  7. Run adb devices -l command. Ensure that your emulator appears on the list, usually named as emulator-5554 and no unauthorized status appear.
  8. Run react-native run-android command. Confirm that the app is built and then running on your emulator with no error.

HOW TO - Creating a new React Native iOS project

Pre-requisites

  1. Ensure that you have installed latest version of XCode.
  2. Ensure that you have installed latest version of react-native-cli.

The steps

  1. Run react-native init <yourprojectname> command for creatint a new React Native project.
  2. Run your iOS emulator.
  3. Change current directory to your project's directory.
  4. Run react-native run-ios command. Confirm that you'll get either infinite build/compile process on your terminal or error on the running server.
  5. Turn off the server, run pkill node command on the server's terminal and then run react-native start --reset-cache command.
  6. Go back to other terminal which points to project's root directory then run react-native run-iod command. Confirm that the app is built and then running on your emulator with no error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment