On this page
The Realm Expo template provides a fully working React Native application that you can use to bootstrap your app development project with Realm. This documentation covers how to initialize and work with the Realm Expo template.
The Realm Expo template uses:
Expo, a framework to develop, build and deploy React Native applications quickly.
@realm/react, an NPM package that provides an easy-to-use API to perform common Realm operations, such as querying or writing to a realm and listening to realm objects.
Next, before you initialize the template, you must install the expo cli by running the following command:
npm install -g expo-cli
To initialize a React Native application using the Realm Expo template use the Expo CLI.
expo init with the flag
--template @realm/expo-template to initialize a
React Native application using the Realm Expo Template.
Run the following command in your terminal:
expo init MyAwesomeRealmApp --template @realm/expo-template
The relevant files are as follows:
A typescript file that defines a Task object schema and returns a
The entry point to the application, which contains methods to create, update, and delete tasks. The
A React component that gets a list of Task objects from the realm and renders each object as a
A React component that displays the task's description, a checkbox to toggle the task's completion status, and a button to delete the task.
To run your application on an Android emulator, run the following command from your application root:
To run your application on an iOS simulator, run the following command from your application root:
When you run the commands above, the Expo dev-client will start
automatically. If you close your Expo
dev-client and want to restart it
without waiting for the native build process again, you can simply run:
expo start --dev-client
However, if you made any changes to the native code, you will have to re-run
expo run:android to rebuild your native iOS/Android app.
To deploy your application, we recommend using the Expo Application Services (EAS), a suite of deeply integrated cloud services for Expo and React Native apps. EAS allows you to compile and sign your App, upload your app to the Apple App Store or Google Play Store with a single CLI command, and push bug fixes or small changes directly to app users.
Alternatively, read the Expo Distribution Overview guide to learn how to create native builds, deploy to app stores, avoid common app store rejections, and manage different release environments.