Hey friend! We are co-hosting a conference with Software Mansion, learn more.
Advanced ExpoKit Topics
This guide goes deeper into a few ExpoKit topics that aren't critical right out of the box, but that you may encounter down the road. If you're not familiar with ExpoKit, you might want to read the ExpoKit guide first.
It is possible to manually "un-detach" your project, for example if you want to return to a JS-only state, or if you want to repeatedly detach for testing purposes. Since your project won't be detached any more, you will no longer be able to use custom native code.
Warning: The following instructions will permanently remove the native iOS and Android code from your project, including any changes you've made. We strongly recommend committing your changes to version control before trying this.
Delete the ios and android directories from your project.
Delete the isDetached and detach keys from your project's app.json.
You can now use your project like a normal Expo project (with no ExpoKit).
Verifying Bundles (iOS only)
When we serve your JS over-the-air to your ExpoKit project, we include a signature so that your project can verify that the JS actually came from our servers.
By default, projects that use ExpoKit have this feature disabled on iOS and enabled on Android. We encourage you to enable it on iOS so that your code is verified for all of your users.
To enable code verification in your native project with ExpoKit:
Fulfill one of these two requirements (you only need one):
Use a non-wildcard bundle identifier when provisioning the app (recommended)
Enable Keychain Sharing in your Xcode project settings under Capabilities. (faster to set up)
In ios/your-project/Supporting/EXShell.plist, set isManifestVerificationBypassed toNO (or delete this key entirely).
Disabling Expo Analytics
On iOS, add the key EXAnalyticsDisabled to your app's main Info.plist with the value YES.
Configuring the JS URL
In development, your ExpoKit project will request your local build from XDE/exp. You can see this configuration in EXBuildConstants.plist (iOS) or ExponentBuildConstants (Android). You shouldn't need to edit it, because it's written automatically when you serve the project.
In production, your ExpoKit project will request your published JS bundle. This is configured in EXShell.plist (iOS) and MainActivity.java (Android). If you want to specify custom behavior in iOS, you can also set the [ExpoKit sharedInstance].publishedManifestUrlOverride property.
Changing the Deep Link Scheme
If you do not have a scheme specified in app.json at the time of detaching, Expo will automatically generate a random one for you. If you'd like to switch to a different scheme after detaching, there are a few places where you need to find an occurrence of your old scheme and replace it with the new one:
app.json (the "scheme" field)
ios/<your-project-name>/Supporting/Info.plist (under the first occurrence ofCFBundleURLSchemes)
android/app/src/main/AndroidManifest.xml (in a line that looks like <data android:scheme="<your-scheme-here>"/>, under MainActivity, or LauncherActivity for older projects)
android/app/src/main/java/host/exp/exponent/generated/AppConstants.java (the SHELL_APP_SCHEME variable)
Enabling Optional Expo Modules on iOS
A few Expo modules are not included in Standalone iOS Apps produced by exp build. Typically this is either because they add a disproportionate amount of bloat to the binary, or because they include APIs that are governed by extra Apple review guidelines. Right now those modules are:
If you want to use any of these modules in your Expo iOS app, you need to detach to ExpoKit rather than using exp build. (It's on our roadmap to improve this.) Within your ExpoKit project, you'll need to include the appropriate subspec in your Podfile. By default, none are included.
In iOS Expokit projects, the DocumentPicker module requires the iCloud entitlement to work properly. If your app doesn't have it already, you can add it by opening the project in Xcode and following these steps:
In the project go to the Capabilities tab.
Set the iCloud switch to on.
Check the iCloud Documents checkbox.
If everything worked properly your screen should look like this:
Using Google Maps
If you integrate Google Maps to your ExpoKit app with the MapView component, you may need to follow additional instructions to provide your Google Maps API key. See the MapView docs.