Expo Docs

Developing With ExpoKit

ExpoKit is an Objective-C and Java library that allows you to use the Expo platform with a native iOS/Android project.

There are two ways to get an ExpoKit project:
Make sure you follow one of the above paths before continuing in this guide. The remainder of the guide will assume you have created an ExpoKit project.

By this point you should have a JS app which additionally contains ios and android directories.

  • Your project's package.json should contain a react-native dependency pointing at Expo's fork of React Native. This should already be configured for you.
  • Your JS dependencies should already be installed (via npm install or yarn).

Open the project in XDE. If you were already running this project in XDE, press Restart.
If you prefer exp, run exp start from the project directory.
This step ensures that the React Native packager is running and serving your app's JS bundle for development. Leave this running and continue with the following steps.

This step ensures the native iOS project is correctly configured and ready for development.
  • Make sure you have the latest Xcode.
  • If you don't have it already, install CocoaPods, which is a native dependency manager for iOS.
  • Run pod install from your project's ios directory.
  • Open your project's xcworkspace file in Xcode.
  • Use Xcode to build, install and run the project on your test device or simulator. (this will happen by default if you click the big "Play" button in Xcode.)
Once it's running, the iOS app should automatically request your JS bundle from the project you're serving from XDE or exp.

Open the android directory in Android Studio, then build and run the project on an Android device or a Genymotion emulator.
When opening the project, Android Studio may prompt you to upgrade the version of Gradle or other build tools, but don't do this as you may get unexpected results. ExpoKit always ships with the latest supported versions of all build tools.
Once the Android project is running, it should automatically request your development url from XDE or exp. You can develop your project normally from here.

Every time you want to develop, ensure your project's JS is being served by XDE (step 2), then run the native code from Xcode or Android Studio respectively.
Your ExpoKit project is configured to load your app's published url when you build it for release. So when you want to release it, don't forget to publish, like with any normal (non-ExpoKit) project.

Your ExpoKit project manages its dependencies with CocoaPods.
Many libraries in the React Native ecosystem include instructions to run react-native link. These are supported with ExpoKit for iOS.
  • If the library supports CocoaPods (has a .podspec file), just follow the normal instructions and run react-native link.
  • If the library doesn't support CocoaPods, react-native link may fail to include the library's header files. If you encounter build issues locating the <React/*> headers, you may need to manually add Pods/Headers/Public to the Header Search Paths configuration for your native dependency in Xcode. If you're not familiar with Xcode, search Xcode help for "configure build settings" to get an idea of how those work. Header Search Paths is one such build setting. The target you care to configure is the one created by react-native link inside your Xcode project. You'll want to determine the relative path from your library to Pods/Headers/Public.

Many libraries in the React Native ecosystem include instructions to run react-native link. These are supported with ExpoKit for Android.

ExpoKit's release cycle follows the Expo SDK release cycle. When a new version of the Expo SDK comes out, the release notes include upgrade instructions for the normal, JS-only part of your project. Additionally, you'll need to update the native ExpoKit code.
Note: Please make sure you've already updated your JS dependencies before proceeding with the following instructions. Additionally, there may be version-specific breaking changes not covered here.

  • Open up ios/Podfile in your project, and update the ExpoKit tag to point at the release corresponding to your SDK version. Re-run pod install.
  • Open ios/your-project/Supporting/EXSDKVersions.plist in your project and change all the values to the new SDK version.

  • Go to https://expo.io/--/api/v2/versions and find the androidExpoViewUrl key under sdkVersions.[NEW SDK VERSION].
  • Download that .tar.gz file and extract it.
  • Go to your project's android directory and replace the detach-scripts and maven directories with the respective directories from the download.
  • Go to MainActivity.java and replace Arrays.asList("[OLD SDK VERSION]") with Arrays.asList("[NEW SDK VERSION]").
  • Go to app/build.gradle and replace compile('host.exp.exponent:expoview:[OLD SDK VERSION]@aar') { with compile('host.exp.exponent:expoview:[NEW SDK VERSION]@aar') {. Depending on what Expo SDK features you are using you might also need to copy other new dependencies from the downloaded app/build.gradle file into yours.