Install
Install on React Native
Install the Sankofa React Native SDK in bare RN or Expo, with auto-applied native configuration via the Sankofa CLI.
The @sankofa/react-native package wraps the native iOS and Android Sankofa SDKs and exposes a single JavaScript surface. It bundles seven products (Analytics, Catch, Switch, Config, Pulse, Replay, Deploy/OTA) — RN is the only mobile SDK that ships OTA Deploy at the package level — and includes an Expo Config Plugin that applies the native setup at prebuild time.
1. Install the package
npx expo install @sankofa/react-nativenpm install @sankofa/react-nativeyarn add @sankofa/react-nativepnpm add @sankofa/react-native2. Wire native projects
The fastest path uses the Sankofa CLI, which detects your project type and applies the right configuration:
npx sankofa initThis:
- adds
@sankofa/react-nativeto theexpo.pluginsarray inapp.json(Expo), or - patches
MainApplication.ktandAppDelegate.swift(bare React Native); - creates
.sankofa.jsonwith the API key, project ID, and endpoint; - updates
.gitignoreto exclude credentials and build artifacts.
After running it, verify everything is wired correctly:
npx sankofa checkManual setup (Expo)
Skip sankofa init and edit app.json yourself:
{
"expo": {
"plugins": ["@sankofa/react-native"]
}
}Then regenerate native projects so the plugin applies:
npx expo prebuild --clean3. Initialize once at app entry
import { Sankofa } from "@sankofa/react-native";
Sankofa.initialize(process.env.EXPO_PUBLIC_SANKOFA_KEY!, {
endpoint: "https://api.sankofa.dev",
recordSessions: true,
maskAllInputs: true,
debug: __DEV__,
});For Expo Router, this lives in app/_layout.tsx. For bare React Native, place it in your root App.tsx or index.js before the first render.
Common init options
apiKeystringRequiredendpointstringdefault https://api.sankofa.devrecordSessionsbooleandefault truemaskAllInputsbooleandefault truetrackLifecycleEventsbooleandefault truedebugbooleandefault false4. Verify the install
Add a single track call in your root component:
import { Sankofa } from "@sankofa/react-native";
Sankofa.track("install_check", { from: "react-native-quickstart" });Reload the app and open app.sankofa.dev → Live events. The event should appear within seconds with a react-native source label and either an ios or android platform tag.