React Native is a popular framework for cross-platform mobile application development using JavaScript and the React library. It enables developers to create native apps for both iOS and Android with a single codebase, significantly reducing development time and resources. With its vibrant community and wide range of ready-to-use components, React Native is an excellent choice for both startups and large companies looking to rapidly build and deploy high-quality mobile products.
For core UI building blocks, see React Native components .
Expo
This platform provides a set of tools and services that help you build and deploy your React Native applications.
Start a project
Install Expo CLI:
npx create-expo-app@latest
Start a project:
npx expo start
App name (label under the icon)
The name shown under the app icon on the home screen is set by expo.name in app.json (or app.config.js / app.config.ts):
{
"expo": {
"name": "My App"
}
}
After npx expo prebuild, the same value is written into the native projects: Android android/app/src/main/res/values/strings.xml (app_name) and iOS Info.plist (CFBundleDisplayName). If those folders already exist, update them as well (or re-run prebuild). A new native build is required for the change to appear on the device.
Two ways to build your app
Using Expo Go
Expo Go is a mobile app that allows you to preview your React Native application on your phone. It has pre-installed React Native libraries and can render your application code directly on your phone. The disadvantage of this approach is that not all React Native libraries are supported by Expo Go. We can check the supported libraries open_in_new here .
Using EAS Build
Development build is a native iOS or Android codebase that can be run on your phone. It uses only specified libraries by your codebase.
To create a development build, we can use the following command:
npx expo prebuild
This command will create a development build with native code in the android and ios directories.
To run the development build, we can use the following command:
npx expo run:android # it will open the app in the Android emulator
npx expo run:ios # it will open the app in the iOS simulator
Expo Application Services (EAS)
EAS is a platform for building and managing your React Native applications. It provides a set of tools and services that help you build and deploy your applications.
Installation
To install EAS, we can use the following command:
npm install -g eas-cli
To login to EAS, we can use the following command:
eas login
To check the current user, we can use the following command:
eas whoami
Building and Deploying
Then to initialize a new project on the Expo Dashboard, we can use the following command:
eas init
To configure the build, we can use the following command:
eas build:configure
It will create a file .eas.json with settings for profiles. By default, we have three profiles: development, preview and production.
{
"cli": {
"version": ">= 20.5.1",
"appVersionSource": "remote"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal"
},
"production": {
"autoIncrement": true
}
},
"submit": {
"production": {}
}
}
To build the application, we can use the following command:
eas build --platform android
eas build --platform ios
This command will build the application for the specified platform. By default, it will build the app for the production profile. To build the app for a different profile, we can use the --profile flag:
eas build --platform android --profile development
eas build --platform ios --profile preview
With development build, you can run the app on your phone and see the changes live. But for this we should install the expo-dev-client package in the project (you will be asked to do this before building the app).
Using emulator
To run the app on an emulator, we can use the following command:
npx expo run:android # it will open the app in the Android emulator
npx expo run:android --device Pixel_Tablet # with the specified device
npx expo run:ios # it will open the app in the iOS simulator
Publishing to the Google Play
To publish your application to the Google Play, you need to have a Google Play Developer Account.
Before publishing, we have to complete testing. We have three options: inner testing, closed testing and open testing.
- Inner testing: only for internal testing
- Closed testing: only for selected users
- Open testing: for all users
You will need to add the Privacy Policy URL. You can generate it here: open_in_new https://www.freeprivacypolicy.com/free-privacy-policy-generator/
Andrew Dorokhov