React Native
Install the React Native bridge, initialize Ansight, and use supported native telemetry, pairing, screenshots, touch capture, artifacts, and React inspection tools.
@ansight/react-native is a bridge over the native iOS and Android SDKs. Pairing, telemetry, screenshots, touch capture, native tools, and binary transfers run in native land; the JavaScript layer exposes app-code APIs and JavaScript-backed React tools.
Install
npm install @ansight/react-native
npx pod-install
Rebuild the native app after installing the package.
The package version expects matching native SDK packages:
| Platform | Native package |
|---|---|
CocoaPods Ansight / AnsightObjC 1.0.2-preview.1 through React Native autolinking | |
Maven ai.ansight:ansight-android 1.0.2-preview.1 through the package Android module |
Quickstart
Initialize from JavaScript app bootstrap, either index.ts / index.js before
AppRegistry.registerComponent(...) or a guarded useEffect(...) in the root
App.tsx. Do not put this in a screen component that can mount repeatedly.
Autolinking handles the native MainApplication, MainActivity, and iOS
AppDelegate wiring for the bridge.
import Ansight from "@ansight/react-native";
const isDevelopmentOnly = __DEV__;
await Ansight.initializeAndActivate({
useNativeAllInOneDefaults: isDevelopmentOnly,
clientName: "React Native App",
hostConnection: isDevelopmentOnly ? {
bundledDeveloperConfigJson: pairingJson,
} : undefined,
toolGuard: isDevelopmentOnly ? "readOnly" : "disabled",
});
await Ansight.connect(null, {
clientName: "React Native App",
expectedAppId: "com.example.app",
});
useNativeAllInOneDefaults defaults to false. It only applies the native iOS/Android all-in-one defaults, including 400 ms sampling, 120 s retention, FPS, touch capture, JPEG capture every 2000 ms at quality 60 and max width 480, host auto-probe, and native tool suites. It is not a master SDK enable switch and does not infer whether the app is a debug build. Gate it with the app’s own condition, such as React Native’s __DEV__, and configure toolGuard, capture options, host auto-probe, and host connection separately.
Important: Screen capture will result in an FPS drop while native frames are captured, encoded, and transported. Disable
sessionJpegCapturefor performance-focused runs unless visual evidence is required. On iOS,captureGpuBackedSurfacesdefaults totrueso Metal, SceneKit, and similar GPU-backed views are included.
React Native memory profiling is enabled by default when the native sampler is available. Configure it with reactNativeMemory.
Use React Native Security before shipping any build that includes the bridge or developer pairing payloads.