React Native ~ Expo - rohit120582sharma/Documentation GitHub Wiki

React Native is a platform that enables you to build native mobile apps using JavaScript.

Expo means you can create React Native apps and deploy them to the app stores using only JS. Additionally, it offers an SDK with access to native functionality such as notifications, camera, contacts, location and so on. It also provides access to some UI components that aren’t included in the React Native core, but are often used, such as icons, blurred views and so on without needing to write a line of native code.

Expo is the easiest way to start building a new React Native application. It also allows you to start a project without installing or configuring any tools to build native code - no Xcode or Android Studio installation required.

References



Installing dependencies

Install Homebrew, Node, and Watchman

First install Homebrew. You can skip below command if brew is already installed on your machine

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then install Node.js which is a JavaScript runtime, to build your JavaScript code. Node comes with npm, which lets you install the other dependencies and tools. Make sure Node version is 8.3 or newer.

brew install node

Then Watchman which is a file watcher from Facebook. This is used by React Native to figure out when your code changes and rebuild accordingly. It’s like having Xcode do a build each time you save your file.

brew install watchman

Install Expo

This installs the expo-cli globally. We'll be using this to create a new project.

sudo npm install -g expo-cli


Build Your App

Create the project

This will create a directory called my-new-project inside the current working directory. Inside my-new-project, this will generate the initial project structure and install all of its dependencies.

expo init my-new-project

Run the project

cd my-new-project
npm start

Note that you can also use expo start or yarn start if you have yarn installed.

Preview the project

Install the Expo Client app on your iOS or Android phone and connect to the same wireless network as your computer. This is the native shell Expo provides that lets you get started without having the build the native app yourself. You will also have to create an Expo account if you don't already have one.

Scan the QR code printed by npm start in your terminal with Expo Client (Android) or Camera (iOS). You may have to wait a minute while your project bundles and loads for the first time.

Eject

If you need to build IPAs and APKs for publishing to the App Store and/or Play Store, you can either eject and build them yourself using Xcode and Android Studio.

This will download the required dependencies and build native projects under the ios and android directories.

expo eject

Build and run your app on iOS / Android simulator

The command will automatically run your app on the iOS Simulator

npm run ios

The command will automatically run your app on the Android Virtual Device

npm run android

⚠️ **GitHub.com Fallback** ⚠️