Here, Tom Duffy shows you how to use the React Native CLI to create a React Native app.
- [Instructor] Using the React Native CLI works nearly identically to create React Native Apps. The commander's certainly different and the output is decidedly different. First, CD into the directory, where you'll store your project, then use the Init command to create your app with the React Native CLI. Follow that with the project name, and then you can use the Run command for the specific platform you want to test to fire up an emulator. When you use the React Native CLI, you won't need expo.
React Native builds native apps from the start. I want to be clear about installing Dependencies when using the React Native CLI. You must configure the Java Home Environment Variable to point to a valid JDK less than Version Nine; JDK-Nine isn't yet supported. In addition, you must configure the Android Home Environment Variable to point to a valid Android SDK. Let's see if we can make this work using the React Native CLI.
The first step would be to CD into the directory where we want to store our project. Then, we'll issue the React Native Init command. Then, we'll just include the name of the project. I'll use RN-Example-Two, because I already have RN-Example built with Create React Native App. Once the project is built, then just CD into the directory you just created; for us, that's RN-Example-Two.
Then, we can issue the Run-IOS command to test on the IOS Simulator; that's React-Native Run-IOS. React Native will fire up the IOS Simulator for us. Eventually, it will load the app in the simulator. Be patient; this can take some time.
There is our default React Native app, running in the IOS Simulator. To test on an Android emulator, start an ADD running Marshmallow 6.0, and then issue the Run Android command. I have an Android 6.0 AVD running. Let's issue the Run Android command. Let's get React Native to build and then run our project on the Marshmallow AVD.
There's our app running on the Android emulator. Let's take a look at the project structure for each of the projects. Here is RN-Example; the one we built with Create React Native App. You'll notice there are no platform-specific folders here. In the second one, using the React Native CLI, you'll notice that there's an Android folder and an IOS folder. Simply put, using the React Native CLI builds all of the project files needed for you to jump directly into doing some Native development.
You can open the projects in Android studio and ExCode, respectively, to make any platform-specific optimizations. But, do that after modifying App dot JS to keep as much functionality as possible in the single-code base.
- Hybrid vs. native cross-platform apps
- Choosing an editor
- Building a Cordova app
- Building an Ionic app
- Buildin an app with the Create React Native App
- Building an app with the React Native CLI
- Building a Titanium app
- Building a Xamarin app
Skill Level Beginner
Ionic 3.0 for Mobile App Developerswith Sani Yusuf5h 43m Intermediate
React Native: Building Mobile Appswith Steven Emmerich2h 32m Intermediate
1. Intro to Cross-Platform Development
4. React Native
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.