React Native
Install the React Native bridge in React Native or Expo development builds, 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, durable crash recovery, native tools, and binary transfers run in native land; the JavaScript layer exposes app-code APIs, framework crash candidates, and JavaScript-backed React tools.
Quickstart
npm install @ansight/react-native
npx pod-install
Rebuild the native app after installing the package.
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";
if (__DEV__) {
await Ansight.initializeAndActivate({
useNativeAllInOneDefaults: true,
clientName: "React Native App",
toolGuard: "readOnly",
});
}
The native simulator or emulator registers automatically with the local CLI
host. Call enrollFromQrCode(...) only from a developer-only screen on a
physical device; do not launch the scanner during every app startup.
useNativeAllInOneDefaults defaults to false. It 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, automatic host-local registration, and native tool suites. It is not a master SDK enable switch and does not infer whether the app is a debug build. Keep the entire initialization call behind the app’s own condition, such as React Native’s __DEV__, and configure toolGuard, capture options, and connection policy separately.
Important: Screen capture will result in an FPS drop while native frames are captured, encoded, and transported. Disable
sessionJpegCapturefor trend-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.
Native Crash Capture is enabled by default. installErrorHandlers(...) enriches the native outbox with unhandled JavaScript errors while also recording exception events.
For the complete guarded startup, stable testID example, and CLI verification
flow, use React Native Setup.
Use React Native Packages for the JavaScript package, native dependency, and platform compatibility reference.
Use React Native Security before shipping any build that includes the bridge or broad remote tools.
Expo Development Builds
Expo apps use the same @ansight/react-native package, but require a custom
development client because Expo Go cannot load the native bridge. Follow the
dedicated Expo development-build setup.