11min

Expo

In order to use the Unflow SDK in an Expo project you will be able to use the Javascript package on NPM. In cases where your app does not yet support native dependencies there are just a few extra steps to get setup. If you already know how to include native dependencies with Expo you can jump straight to integrating as if it were a normal React Native installation.

1. Supporting native dependencies

Expo Go is a great way of getting your project off the ground quickly and sharing versions of your app within your team. How it works is that it includes the most common native components / APIs your Expo app might need (e.g. Camera, Permissions, Contacts, Calendar access, etc.) so that you can build exclusively in Javascript (or Typescript). As is the case with most production apps, you will eventually be required to include packages. These packages might be necessary to support anything from Payments to Facial Recognition. They will also rely on native APIs that are not included in the default build of Expo Go.

Therefore, you need a way of updating the build to include the required native dependencies. Expo provides an easy way to achieve this using what are known as Development Builds.

Before you create your first Development Build it is necessary to add the expo-dev-client library, which allows you to continue developing and debugging projects from expo-cli or a compatible server.

Console
|

You can create your first Development Build using EAS or locally (if you have XCode and Android Studio installed) using the appropriate command for the respective platforms.

Console
|

This can take some time but you will see that two new directories are created in your project called ios/ and android/. You can confirm that your app works exactly as before by running expo start --dev-client. Your app will now appear as an app of its own, instead of being opened through the Expo Go app. This is because you've essentially told Expo that you will be wanting to add your own native elements that are not included in the default build that Expo Go runs.

You (and any developer on your team) will not need to call expo run again unless you update the native dependencies. It should be enough to call expo start until that time so everything stays as fast as it always was.

Now for the fun part! Time to add the Unflow SDK. All you need to do is add it via yarn. Because Unflow includes a new native dependency (the SDK only shows native UI components) you will need to generate a new build using the same commands as before. This will install Unflow via the respective native dependency managers on iOS and Android, CocoaPods and Gradle.

Console
|

The expo start command can again be used to develop the app once the changes to the build are committed and share with all developers on the team (until you decide to add more native dependencies in the future).

A sample repository with each of the above mentioned steps separated into commits is available as a reference should you wish to see the changes necessary to a fresh Expo Go project.



Option 2: Ejecting

Alternatively you may want to convert your Expo project into a standard React Native one. This is possible by ejecting your app from being managed through the Expo workflow

Console
|



2. Setting up the SDK

Once you have a means of including native dependencies in your Expo project you can follow the exact same instructions found in the React Native documentation. If you used Development Builds (Option 1 above) you will be able to skip straight to the Configuring the SDK section because you will already have the package installed.



Updated 16 Mar 2022
Did this page help?
Yes
No