As a software engineer atInfinite Red, I have been privileged to work on several React Native projects over the last month. Under the tutelage of Steve Kellock, Gant Laborde, and Mark Rickert, I was shocked at how quickly I was able to ramp up on this new technology. Normally a new technology takes me several months to get to a point where I can feel productive on my own, but with React Native it only took a few days, so huge kudos to them for setting up outstanding projects and the engineers at Facebook for creating such an awesome framework.
Spoiler alert: it is!
You may have noticed that while Facebook has detailed instructions for getting started with React Native development on OS X , their instructions for getting started on Windows are a little lacking. Here are the steps I went through to get React Native running.
Note: my computer is running a Windows Insider build that already has the Bash for Windows support mentioned above. If you are unable to wait until the Bash for Windows feature is released to the public or upgrade your Windows installation to an Insider build, your next best bet is to try a tool that includes Bash, like Git for Windows .
Step 1: Prerequisites & Prep Work
- Download and install JDK (v7 or newer)
- Download and install Node
- Download and install Android Studio
- Create an environment variable with the Java SDK path: Windows → Search → System → Advanced System Settings → Environment variables → New
- Due to a custom Android SDK installation location I also had to set an extra environment variable:
Step 2: Configure an Android Virtual Device
- Set up Android Studio
- Create an empty Android Studio project
- Create an Android Virtual Device: Manage AVD → Create
- Boot your Android Virtual Device
Step 3: Jump into Command Line
- Open command prompt, jump into bash, and navigate to where you want your project to live
- Install React Native globally:
npm install -g react-native-cli
- Create a new React Native project ( Note: this step may take a while):
react-native init AwesomeProject
- CD into your new project
- Optional: Configure Gradle Daemon for faster compiling:
((if not exist “%USERPROFILE%/.gradle” mkdir “%USERPROFILE%/.gradle”) && (echo org.gradle.daemon=true >> “%USERPROFILE%/.gradle/gradle.properties”))
- Change your android/app/build.gradle file to use your installed version of Android SDK (I had to change mine from 23.0.1 to 23.0.3)
- Start your application
- Manually start the packager (doesn’t currently start automatically on Windows, but probably will at some point in the future)
As React Native becomes more popular, and the recently announced Windows support begins to come online, the setup process is likely to become more streamlined. In the meantime, hopefully this is enough to get you up and running! Stay tuned for a future article detailing the setup process for running your React Native project as a Windows application.
转载本站任何文章请注明：转载至神刀安全网，谢谢神刀安全网 » Getting Started with React Native Development on Windows