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

bash
npx expo install @sankofa/react-native

2. Wire native projects

The fastest path uses the Sankofa CLI, which detects your project type and applies the right configuration:

bash
npx sankofa init

This:

  • adds @sankofa/react-native to the expo.plugins array in app.json (Expo), or
  • patches MainApplication.kt and AppDelegate.swift (bare React Native);
  • creates .sankofa.json with the API key, project ID, and endpoint;
  • updates .gitignore to exclude credentials and build artifacts.

After running it, verify everything is wired correctly:

bash
npx sankofa check

Manual setup (Expo)

Skip sankofa init and edit app.json yourself:

JSONapp.json
{
"expo": {
  "plugins": ["@sankofa/react-native"]
}
}

Then regenerate native projects so the plugin applies:

bash
npx expo prebuild --clean

3. Initialize once at app entry

TSXApp.tsx
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

apiKeystringRequired
Your project's API key. Use a test key in development.
endpointstringdefault https://api.sankofa.dev
Server base URL.
recordSessionsbooleandefault true
Enable session replay capture.
maskAllInputsbooleandefault true
Auto-mask all <TextInput> components in replays.
trackLifecycleEventsbooleandefault true
Auto-track $app_opened, $app_foregrounded, $app_backgrounded.
debugbooleandefault false
Verbose logging — leave on in development with __DEV__.

4. Verify the install

Add a single track call in your root component:

TSX
import { Sankofa } from "@sankofa/react-native";

Sankofa.track("install_check", { from: "react-native-quickstart" });

Reload the app and open app.sankofa.devLive events. The event should appear within seconds with a react-native source label and either an ios or android platform tag.

What's next

Edit this page on GitHub