Set Up Your React Native Development Environment
- The software setup required for React Native development.
- How to install the forcereact utility.
- Successful completion of step 1, Install Common Components.
- One of the following:
- A Mac OS X development machine and successful completion of step 2, Install the Android Development Environment, or step 3, Install the iOS Development Environment, or both.
- A Windows development machine and successful completion of step 2, Install the Android Development Environment.
If you’ve come this far, you’re ready to create React Native apps for Android, iOS, or both. You’re also perfectly positioned to install the tools for developing Mobile SDK React Native apps.
React Native development requires the Mobile SDK common software and at least one native development environment—Android on Windows; Android, iOS, or both on Mac OS X. If you jumped into this project here, without doing any of the previous steps, go back and start at step 1. Then continue to a native development installation before returning here.
Once you’ve installed either the Android or the iOS development environment, enabling the React Native option is easy. The only missing piece is the forcereact npm utility.
You can develop React Native apps on either Mac or Windows development machines, but you can’t do in-depth iOS development on a Windows machine.
To create React Native apps for Mobile SDK, you use a node.js command-line utility named forcereact. Forcereact is the quickest and easiest way to create React Native apps for Mobile SDK. You just enter some metadata as prompted, and a few minutes later you’re ready to develop on iOS, Android, or both.
To install forcereact, you use the npm install command.
- Open the Terminal app on Mac, or the command prompt on Windows.
- If you’re planning to develop on Android, define an ANDROID_HOME system variable that points to your installed Android SDK. For example, on a Mac, the path is typically /Users/<username>/Library/Android/sdk. Be sure to store the variable in your persistent environment settings so that you don’t have to keep retyping it.
To install forcereact, run the npm install
- On a Mac, type sudo npm install -g forcereact and press Return.
- On Windows, type npm install -g forcereact and press Return.
- If prompted on a Mac, enter your system password.
- To test your installation, type forcereact version and press Return.
- To get forcereact usage information, type forcereact and press Return.
Congratulations! If you’ve completed this step, you’re ready to create React Native apps. To get started, use the forcereact create command. You specify which platforms to support––iOS, Android, or both––as well as some app metadata.
Remember, if you installed only one native development environment, you can come back at any time to install the other one. Just check to be sure that your current Mobile SDK components are up to date with the versions listed in this project.
We won’t check any of your setup. Click Verify Step.