React-Native: Install React Native on MAC vn-me.com/videos/video-kDSBjOfJjnY.html vn-me.com/videos/video-MdtyYCbSRiY.html Let's create a React Native app and get it up and running on an iOS and Android emulator! The github repo is at goo.gl/AJTm8N.
. 完整原生环境. 简易沙盒环境 译注:沙盒环境大量依赖于国外网络环境,也不能直接发布应用,只是用于学习、演示、试验等目的。不建议国内用户使用。 is the easiest way to start building a new React Native application.
It allows you to start a project without installing or configuring any tools to build native code - no Xcode or Android Studio installation required (see ). Assuming that you have installed, you can use npm to install the create-react-native-app command line utility: npm install -g create-react-native-app Then run the following commands to create a new React Native project called 'AwesomeProject': create-react-native-app AwesomeProject cd AwesomeProject npm start This will start a development server for you, and print a QR code in your terminal. Running your React Native application Install the client app on your iOS or Android phone and connect to the same wireless network as your computer.
Using the Expo app, scan the QR code from your terminal to open your project. Modifying your app Now that you have successfully run the app, let's modify it. Open App.js in your text editor of choice and edit some lines. The application should reload automatically once you save your changes. You've successfully run and modified your first React Native app.
Create React Native App also has a you can reference if you have questions specific to the tool. If you can't get this to work, see the section in the README for Create React Native App. If you're curious to learn more about React Native, continue on to the. Running your app on a simulator or virtual device Create React Native App makes it really easy to run your React Native app on a physical device without setting up a development environment. If you want to run your app on the iOS Simulator or an Android Virtual Device, please refer to the instructions for building projects with native code to learn how to install Xcode and set up your Android development environment. Once you've set these up, you can launch your app on an Android Virtual Device by running npm run android, or on the iOS Simulator by running npm run ios (macOS only).
Caveats Because you don't build any native code when using Create React Native App to create a project, it's not possible to include custom native modules beyond the React Native APIs and components that are available in the Expo client app. If you know that you'll eventually need to include your own native code, Create React Native App is still a good way to get started. In that case you'll just need to ' eventually to create your own native builds.
If you do eject, the 'Building Projects with Native Code' instructions will be required to continue working on your project. Create React Native App configures your project to use the most recent React Native version that is supported by the Expo client app. The Expo client app usually gains support for a given React Native version about a week after the React Native version is released as stable. You can check to find out what versions are supported. If you're integrating React Native into an existing project, you'll want to skip Create React Native App and go directly to setting up the native build environment. Select 'Building Projects with Native Code' above for instructions on configuring a native build environment for React Native.
Follow these instructions if you need to build native code in your project. For example, if you are integrating React Native into an existing application, or if you 'ejected' from, you'll need this section. 根据你所使用的操作系统、针对的目标平台不同,具体步骤有所不同。如果想同时开发 iOS 和 Android 也没问题,你只需要先选一个平台开始,另一个平台的环境搭建只是稍有不同。 如果 阅读完本文档后还碰到很多环境搭建的问题,我们建议你还可以再看看由本站提供的 环境搭建视频教程(、、)、、以及。注意!视频教程或者其他网络上的博客和文章可能和本文档有所出入,请以最新版本的本文档所述为准!.