@trevosdk/react-native runs experiments and records events in React Native and Expo apps,
assigning the same variants the web SDK does for the same user.
Pure TypeScript — no native module, no linking step, no config plugin.
Expo:
Quick start
Create the client in its own module. This example uses Expo’s public environment convention; in bare React Native, use the app’s existing runtime-config adapter.null, so AsyncStorage hydration cannot flash control to a treatment user. If
auth restores a known user, call trevo.identify(user.id) before mounting this
experiment UI.
tsk_live_…, created under API Keys). A shipped binary can be unpacked,
so a secret key in an app is a leaked key. With a Mobile key, a shipped experiment stays in
the config for a year, so old builds that still have its code keep getting the winner; a Web
key drops it after 30 days.
Before your first mobile experiment
Mobile experiments ramp over weeks, wait for an app release, and keep running on old builds. Mobile experiments covers what that means for planning, how the SDK survives a lost network or a killed app, and the App Store and Google Play answers.Gating on app version
An experiment whose variant code only exists from a given build onward should not enrol devices that cannot render it. SetminAppVersion on the experiment:
control and record no exposure, so they never appear in the
results. This requires you to pass appVersion when creating the client — without it, a
gated experiment returns control for everyone, because the SDK cannot prove the build is new
enough and guessing wrong means a broken screen.
Always pass the installed binary’s real app version, never a copied sample. Expo apps can read
it from expo-application (npx expo install expo-application):
Options
API summary
Expo
Works in Expo Go and in development builds with no config plugin — there is no native code to link. Install AsyncStorage the Expo way:Store compliance
The package shipsios/PrivacyInfo.xcprivacy. The Google Play data safety answers are in
Mobile experiments.