React Native Setup
Install @ansight/react-native and initialize the bridge from app code.
Install the JavaScript package from npm and rebuild the native app.
npm install @ansight/react-native
npx pod-install
npx react-native run-ios
npx react-native run-android
The package podspec is consumed by React Native autolinking. Run pod-install after package updates so the iOS project links Ansight and AnsightObjC. Android autolinking resolves ai.ansight:ansight-android from Maven Central through the package Android module.
Initialize Ansight once from JavaScript app bootstrap. Put the helper below in a
startup module called from index.js or index.ts before
AppRegistry.registerComponent(...), or call it from a guarded useEffect(...)
in the root App.tsx / App.jsx if setup depends on React-provided
configuration. Do not put initialization in a screen component that can mount
repeatedly.
For a normal React Native app, do not manually edit native MainApplication,
MainActivity, or iOS AppDelegate just to install the bridge; autolinking
handles the native package wiring. Use native files only for app-owned native
tools or custom pairing UI after the bridge has initialized.
TypeScript
import Ansight from "@ansight/react-native";
let ansightStarted = false;
export async function startAnsight() {
if (ansightStarted) {
return;
}
ansightStarted = true;
const isDevelopmentOnly = __DEV__;
await Ansight.initializeAndActivate({
useNativeAllInOneDefaults: isDevelopmentOnly,
clientName: "React Native App",
hostConnection: isDevelopmentOnly ? {
bundledDeveloperConfigJson: pairingJson,
} : undefined,
toolGuard: isDevelopmentOnly ? "readOnly" : "disabled",
});
}
JavaScript
import Ansight from "@ansight/react-native";
let ansightStarted = false;
export async function startAnsight() {
if (ansightStarted) {
return;
}
ansightStarted = true;
const isDevelopmentOnly = __DEV__;
await Ansight.initializeAndActivate({
useNativeAllInOneDefaults: isDevelopmentOnly,
clientName: "React Native App",
hostConnection: isDevelopmentOnly ? {
bundledDeveloperConfigJson: pairingJson,
} : undefined,
toolGuard: isDevelopmentOnly ? "readOnly" : "disabled",
});
}
Call void startAnsight(); from index.ts / index.js, or call it once from
the root App component’s useEffect(...) if your setup needs React-provided
configuration.
Important: Enabling native all-in-one defaults enables session JPEG capture. Screen capture will result in an FPS drop while frames are captured, encoded, and transported. Disable
sessionJpegCapturefor performance-focused runs unless visual evidence is required.
Do not ship developer pairing payloads or broad remote-tool access in App Store, Play Store, CI release, or other distributable builds.