@nituri/react-native
v0.1.0
Published
Nituri event-tracking SDK for React Native — a TurboModule over the native Android (AAR) and iOS (XCFramework) SDKs.
Readme
@nituri/react-native
React Native shell for the Nituri event-tracking SDK. A TurboModule wraps the
native Android (AAR com.nituri:core-android) and iOS (XCFramework NituriCore
- the
ios-sdkSwift package) SDKs, so capture fidelity is identical to using the bare native SDKs directly.
Status — Phase A4. Landed: the JS/TypeScript layer (facade, TurboModule contract, React Navigation hook), the Android TurboModule (
android/, bridgingcom.nituri.android.Nituri), the iOS module (ios/, bridging theNituriSwift SDK), the Expo config plugin (app.plugin.js), and autolinking config. The JS layer is fully tested (facade marshaling + theuseNituriScreensrender integration test). The native modules build inside a React Native host app (codegen + published core artifacts) / CI — they are not built standalone in this repo. See _SDK-ARCHITECTURE.md §9. Remaining: native compile + a device/simulator e2e on a sample app across RN versions (arch §10 release gate) — needs the RN/Android/Xcode toolchain.
What runs where
- Native (not JS): autocapture — taps, screen views, app lifecycle, uncaught exceptions, performance vitals — plus the queue, batching, flush, retry, and install attribution. Crashes that take down the JS bridge are still captured by the native exception handler.
- JS: the public API surface (marshalled to native via the TurboModule) and
the
useNituriScreenshook that bridges React Navigation routes to$screen_view(native screen detection can't see RN routes).
Usage
import { Nituri, useNituriScreens } from '@nituri/react-native';
Nituri.initialize({ publicKey: 'pk-...', autocapture: true });
Nituri.track('checkout_started', { amount: 99 });
Nituri.identify('u_42', { identifiers: { email: '[email protected]' }, traits: { plan: 'pro' } });
Nituri.screen('Home');
Nituri.set_consent(true); // wire to your consent banner
Nituri.handleDeepLink(url); // forward OS deep links for attribution
const attribution = await Nituri.getAttribution();
const state = await Nituri.getState();React Navigation screen tracking:
const navRef = useNavigationContainerRef();
useNituriScreens(navRef);
return <NavigationContainer ref={navRef}>{/* ... */}</NavigationContainer>;Architecture support
- New Architecture (TurboModules + Fabric) is the primary path.
- Legacy bridge (RN < 0.75) supported for one year after the New Architecture default lands.
- Expo: a config plugin (coming) wires the Android install-referrer permission
and the iOS
Info.plistentries.
Develop
npm install
npm run typecheck # tsc --noEmit
npm test # Jest — facade marshaling unit testsThe native modules build via the host app's Gradle / CocoaPods once added.
