📅  最后修改于: 2023-12-03 14:41:04.184000             🧑  作者: Mango
Expo is a free and open source toolchain built around React Native to help you build native iOS and Android projects using JavaScript and React. Expo makes it easy to develop, build, and deploy your React Native applications.
To get started with Expo, you need to first install the Expo CLI. To install the Expo CLI globally, run the following command in your terminal or command prompt:
npm install -g expo-cli
Once you have the Expo CLI installed, you can create a new project by running the expo init
command. This will create a new directory for your project and set up the basic project structure for you.
To create a new project with the default options, simply run the following command in your terminal or command prompt:
expo init my-new-project
This will create a new directory called my-new-project
and set up a basic project structure for you. You will be prompted to choose a template for your project, such as a blank project, a project with pre-built tabs and navigation, or a project with authentication functionality.
When you create a new project with Expo, you will see a project structure that looks something like this:
my-new-project/
├── App.js
├── app.json
├── assets
│ └── icon.png
└── package.json
App.js
contains the entry point for your Expo application. This file is where you will write your React Native code.app.json
is a configuration file for your app. It contains information such as your app's name, version number, and icon.assets
is a directory where you can store images, fonts, and other static assets used by your app.package.json
is where you will define your app's dependencies and scripts for running and building your app.You can run your app using the Expo CLI's expo start
command. This will start the Expo Development Server and open up a web browser where you can select either to run your app on an Android/iOS emulator or on your own device via the Expo Client app.
cd my-new-project
expo start
Once you have the Expo Dev Server open in your browser, you can run your app on a connected device, emulator or simulator by downloading the Expo Client app and scanning the QR code with your camera.
Expo is a powerful toolchain that extends React Native's capability while greatly simplifying the development process. With its simple CLI and powerful development tools, Expo makes it easy to develop and deploy your React Native applications on both iOS and Android platforms. Give it a try and see how it can help streamline your development process.