Skip to content

React Native installation

  • React Native 0.75 or later. The package is built and tested on React Native 0.88 with the New Architecture; if you are on an older version or the old architecture and something does not build, tell us.
  • iOS 15 or later, Android minSdk 23 or higher
  • The team’s SDK key (rsk_…) from the form’s Share → Mobile app tab

The package is a native module. It supports the New Architecture (TurboModule) and falls back to the old architecture. It does not run in Expo Go.

The package is @responsly/react-native-sdk. It is not on the public npm registry. Make it available to your project as described in your access details, then add it.

Terminal window
npm install @responsly/react-native-sdk
cd ios && pod install

Autolinking does the rest. The package contains the native iOS and Android SDK sources, so you do not add a CocoaPods source, a Maven repository or a native dependency yourself.

If the build fails on a deployment target or minSdk error, raise the project’s minimums.

ios/Podfile
platform :ios, '15.0'
android/build.gradle
buildscript {
ext {
minSdkVersion = 23
}
}

In Expo, set them with the expo-build-properties plugin instead of editing native files.

Call initialize once at the app root, outside of any component, so it runs before the first screen renders.

index.js
import { AppRegistry } from 'react-native'
import Responsly from '@responsly/react-native-sdk'
import App from './App'
import { name as appName } from './app.json'
Responsly.initialize('rsk_…', { logLevel: __DEV__ ? 'debug' : 'error' })
AppRegistry.registerComponent(appName, () => App)

With Expo Router, put the call at module level in the root layout:

app/_layout.tsx
import { Stack } from 'expo-router'
import Responsly from '@responsly/react-native-sdk'
Responsly.initialize('rsk_…', { logLevel: __DEV__ ? 'debug' : 'error' })
export default function RootLayout() {
return <Stack />
}

Calls made before initialize (identify, track, screen and the rest) are remembered and applied when the SDK starts. initialize is idempotent for the same key, so Fast Refresh is not a problem.

FieldValuesNotes
logLevel'none', 'error', 'info', 'debug'Use 'debug' while integrating. See Testing & debugging.
apiHoststringDefaults to https://api.responsly.com. Leave it unset unless Responsly support gives you another host.

The package adds two helpers on top of the native API:

  • createNavigationTracker(navigationRef) reports the active React Navigation route as the current screen.
  • useResponslyScreen(name) reports a screen from inside a component.

Both are shown in Track events & screens.