Expo CLI is the successor to create React Native App. It allows you to build Android and iOS apps with no build configuration. This means that developers can build native iOS applications without even owning a Mac computer. Typically, setting up a project is easy and can be done in minutes in the best case. Let’s start to install Expo.
1. Installing Expo CLI
Let’s install Expo CLI globally, you can do this by running the following command.
npm install -g expo-cli //or yarn add global expo-cli
2. Initiate the project
First, create my-app using this command in the terminal:
expo init my-app
Then go to the directory with the following command in the terminal:
3.Finally, run the project
expo start //or yarn start
Then it’ll show the result:
Also, it’ll open Expo Developer Tools, a browser-based graphical UI for quickly setting up your testing devices and emulators for Expo development, streaming device, and bundler logs and deploying updates.
4.Viewing a Project on Your Phone or Simulator
The server will continue running until you close it. To develop and preview apps with Expo, we need to install its Expo app on your Android or iOS device. It’s available on the Google Play Store and on the iOS App Store.
Open the app Expo and you’re available to test your app. For the app to load on your physical device, you’ll need to make sure that your phone is connected to the same local network as your computer.
5. Move to React Native
However, you can eject your project to plain React Native. From your project directory, just run the following the command :
This will download the required dependencies and build native projects under the ios and android files.
6.Publishing a Project
To publish something you’ve made, just follow these steps:
1. Create an Expo account or login to an existing one by running the following command:
2. Run an Expo CLI server using the command:
3. Check to make sure you can load your app by opening it in the Expo app.
4. Once everything looks good, run the following command:
A few seconds later, you should get a clean URL sent to you that points to the exp.host server where your package was published to.
That’s it! You’ve successfully run your first Expo app. Happy coding.