Expo Development Builds
Add the Ansight React Native bridge to an Expo development build, initialize it from app bootstrap, and verify the first connection.
Expo Go is not supported. Ansight includes native iOS and Android modules, so use a custom development client or an EAS development build.
1. Add the package
npx expo install expo-dev-client @ansight/react-native
Generate or update the native projects and launch one development client:
npx expo prebuild
npx expo run:ios
# or: npx expo run:android
If the project does not commit native folders, use its normal prebuild process or create an EAS development build instead:
eas build --profile development --platform ios
# or: eas build --profile development --platform android
2. Initialize the development build
Initialize once from index.ts / index.js before app registration, or from a
guarded useEffect(...) in the root app component:
import Ansight from "@ansight/react-native";
let ansightStarted = false;
export async function startAnsight(): Promise<void> {
if (!__DEV__ || ansightStarted) {
return;
}
ansightStarted = true;
await Ansight.initializeAndActivate({
useNativeAllInOneDefaults: true,
clientName: "Expo App",
toolGuard: "readOnly",
});
}
Call void startAnsight(); once during app bootstrap. Use a separate
development target when the native package must be absent from distributable
builds.
3. Add stable test ids
<Pressable testID="login-button" onPress={signIn}>
<Text>Sign in</Text>
</Pressable>
Stable testID values make live and recorded React trees easier for developers
and agents to query.
4. Run and verify
Start the host in one terminal:
ansight host run
Launch the custom development client. From another terminal, confirm its session and tool catalog:
ansight session list --connected --json
ansight app tools <session-id> --json
A physical device requires the one-time enrollment flow.
Troubleshooting
- The app is still running in Expo Go: install
expo-dev-client, rebuild, and open the custom client instead. - The native module is missing: rerun
npx expo prebuild --clean, reinstall pods when using iOS locally, and rebuild the client. - The app does not connect: confirm
ansight host runis active, runansight doctor, and check that the app is using the development build.
Continue with React Native Configuration and React Native Security after the first connection works.