Skip to main content

Installation

The SDK is published to the public npm registry under the scope @b2metric/react-native-sdk.

Installation is a two-step process: add the JavaScript package via your package manager, then run CocoaPods on iOS so the native module is linked. Android is handled automatically by Gradle and React Native's autolinking — no manual changes are required.

3.1 Add the Package

Use whichever package manager your project already uses. Both commands below install exactly the same artifact; pick the one that matches your existing lockfile.

# npm
npm install @b2metric/react-native-sdk

# or yarn
yarn add @b2metric/react-native-sdk

3.2 Install iOS Pods

After the JavaScript package is installed, the iOS native module must be linked through CocoaPods. Run the following from the project root:

cd ios && pod install && cd ..

If you use a package manager other than CocoaPods on iOS (for example, Swift Package Manager only), please contact the B2Metric team — the SDK currently ships with a CocoaPods podspec and assumes a standard React Native iOS project layout.

3.3 Android

Nothing to do. React Native's autolinking discovers the SDK module via the package's react-native.config.js and registers it during the next Gradle build.

Tip

After running pod install on iOS, also clear the Metro cache once (npx react-native start --reset-cache) before your first build. This avoids stale module resolution that can otherwise cause a confusing 'cannot find module' error on the first run after adding a new native dependency.