Skip to content

Bare React Native (no expo prebuild)

This page is for an app with its own ios/ and android/ folders that never runs expo prebuild. The SDK works in it if the app has the expo package and Expo’s native modules set up: npx install-expo-modules@latest adds them. Install the packages as Install by hand shows, then follow this page.

The SDK’s native module is an Expo module. Its pod depends on ExpoModulesCore, its Android library on expo-modules-core, and the app finds it through Expo autolinking. Metro also reads the app config through the expo package.

The config plugin runs only inside expo prebuild, so it does not run in this app. Skip it. Keep its entry under expo.plugins in app.json only to set the plugin options. Metro reads them from there, and without the entry they take their defaults.

On iOS, run pod install in the ios folder after you install the package. The Podfile needs use_expo_modules!.

Terminal window
cd ios && pod install

On Android there is no step of its own. Expo autolinking links the module when Gradle builds, and settings.gradle needs expoAutolinking.useExpoModules() for that.

Wrap the Metro config your app already has, as in Two config changes. It must set transformer.babelTransformerPath, or the build stops with an error that names it.

Set KEEPSNAPPY=1 in the environment of the command that builds the app, such as xcodebuild or ./gradlew assembleRelease. For the routes that need them, set EXPO_PUBLIC_KEEPSNAPPY_KEY and EXPO_PUBLIC_KEEPSNAPPY_INGEST_URL there too. Metro reads them from its own environment when it bundles. The SDK’s Babel transformer inlines them into the SDK’s own code, so your Babel preset doesn’t matter.

Store builds

With the build switch off, a store build has no SDK in its JS bundle. Its binary still has the native module, which stays idle. To leave it out of the binary too, exclude the package while the switch is off, the way the plugin does. Add the first line to the Podfile and the second to settings.gradle:

use_expo_modules!({ exclude: ['@keepsnappy/react-native'] })
expoAutolinking.exclude = (expoAutolinking.exclude ?: []) + ['@keepsnappy/react-native']

Next

Check that a store build carries none of the SDK: Store builds.