Docs Menu
Docs Home
/ /
Atlas Device SDKs
/

Bootstrap with Expo - React Native SDK

On this page

  • Prerequisites
  • Initialize the Template
  • Explore the File Structure
  • Build and Run the Application
  • Deploying Your Application

The Atlas Device SDK Expo template provides a fully working React Native application that you can use to bootstrap your app development project with Atlas Device SDK. This guide covers how to initialize and work with the template.

The Expo template uses:

  • Expo: a framework for developing, building and deploying React Native applications.

  • @realm/react: an npm package that provides an easy-to-use API to perform common Realm operations, such as querying or writing to a database and listening to database objects.

Check out the compatibility chart to determine which version of the Expo SDK is compatible with specific React Native SDK versions.

To initialize the template application, use create-expo-app. Pass the flag --template @realm/expo-template to initialize a React Native application based on the Device SDK template.

Run the following command in your terminal:

npx create-expo-app AtlasDeviceSdkApp --template @realm/expo-template

Install app dependencies:

npm install

The relevant files are as follows:

File
Purpose
Task.ts
A typescript file that defines a Task object schema and returns a RealmProvider and the hooks.
App.ts
The entry point to the application, which contains methods to create, update, and delete tasks. The RealmProvider component wraps around the App component, providing your entire application with access to the realm.
TaskList.tsx
A React component that gets a list of Task objects from the database and renders each object as a TaskItem component.
TaskItem.tsx
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:

npx expo run:android

To run your application on an iOS simulator, run the following command from your application root:

npx expo run:ios

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:

npx expo start --dev-client

However, if you made any changes to the native code, you will have to re-run npx expo run:ios or npx 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.

Back

Quick Start

Next

Realm Files