React Native
Investigate React Native and Expo app behavior with JavaScript and native evidence, session replay, and live inspection tools.
Understand a React Native issue across the screen, JavaScript state, and native runtime. Ansight brings session evidence and inspection tools to React Native and Expo development builds so developers and agents can investigate those layers together.
@ansight/react-native is a bridge over the native iOS and Android SDKs. Pairing, telemetry, screenshots, touch capture, durable crash recovery, native tools including Clipboard, and binary transfers run in native land; the JavaScript layer exposes network capture, purchase diagnostics, app-code APIs, framework crash candidates, and JavaScript-backed React tools.
Open your app repository in a coding agent and send this prompt:
Copyable prompt:
Use https://www.ansight.ai/skills/react-native/ansight-install-react-native.md to install Ansight in this React Native app. Keep it in a development build, verify a connected session, and show me the changes.
The setup guide has the manual steps. Expo apps should use the Expo development-build guide.
Quickstart
npm install @ansight/react-native@latest
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.
Use Network Capture for opt-in fetch and
XMLHttpRequest evidence, Clipboard Tools for native
device clipboard access, and Purchase Diagnostics for
simulator/emulator-only StoreKit and Google Play validation.
Use Connectivity Capture to record OS connection state, transport changes, and supported quality estimates. See Native Offline Capture for disconnected recording and host transfer across mobile SDKs, implemented after SDK 1.8.0.
Use React Native Motion Capture to forward shakes and accelerometer samples from handlers your app already owns.
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.