Expo / React Native
The React Native adapter is @quameleon/qa-react-native. It ships the Kotlin and Swift cores, an Expo config plugin
and a JavaScript API. It works with the New Architecture and with Hermes.
1. Install
Section titled “1. Install”npx expo install @quameleon/qa-react-native2. Configure the Expo plugin
Section titled “2. Configure the Expo plugin”{ "expo": { "plugins": [["@quameleon/qa-react-native", { "production": true }]] }}The plugin adds ACCESS_NETWORK_STATE, bakes a build id, and exports the release sourcemap for symbolication.
- Without
production: truethe plugin treats the SDK as QA-only and refuses to configure a store build unlessQUAMELEON_ALLOW_STORE=1is set. - With
production: truestore profiles are allowed, and QA activation is baked off in every build that is not an explicit QA build (dev.qualgent.quameleon.QA_ACTIVATION=falseon Android,QuameleonQAActivation = NOin Info.plist), whatever the profile is called, so a store build can never be driven by a test host. QA builds are the EAS profiles inqaProfiles(defaultdevelopment,preview,qa,e2e) orAPP_VARIANTs inqaVariants(defaultdevelopment,dev,preview,qa,e2e); override with those options orisQaBuild(env)inapp.config.js. Debug builds can always be driven. - Android QA activation also needs the test host’s adb provisioning (
settings put global quameleon_qa_token …, done byquameleon-qa), so another app on the device cannot activate QA mode by launching yours with a token.
Bare React Native apps get the same native modules through autolinking; run pod install after installing or
upgrading.
3. Start production mode
Section titled “3. Start production mode”Call startProduction as early as possible, before the first render:
import Quameleon, { QuameleonErrorBoundary } from "@quameleon/qa-react-native";import { Stack, useNavigationContainerRef } from "expo-router";import { useEffect } from "react";
if (!Quameleon.isActive()) { // A QA run (launched with a token) is already active and stays in QA mode. Quameleon.startProduction({ apiKey: process.env.EXPO_PUBLIC_QUAMELEON_KEY!, endpoint: "https://quameleon.qualgent.ai", publicKey: process.env.EXPO_PUBLIC_QUAMELEON_PUBLIC_KEY, // encrypts the spool and uploads replay: { sampleRate: 0.1 }, // local default; remote config overrides it });}
export default function RootLayout() { const nav = useNavigationContainerRef(); useEffect(() => Quameleon.trackNavigation(nav), [nav]); // one `screen` signal per route change return ( <QuameleonErrorBoundary name="root"> <Stack /> </QuameleonErrorBoundary> );}replay and deviceId are SDK 0.5 options; every other field works from 0.4. See the full list in
Configuration options.
4. Identify users and capture events
Section titled “4. Identify users and capture events”// After sign-in: links this device and its sessions to your user id. Persisted across launches.Quameleon.identify(user.id, { plan: "pro", company: "Acme" });
// Product events, for Events, Trends, Funnels and Retention.Quameleon.capture("order.placed", { items: 2, total: 49.9 });
// On sign-out.Quameleon.reset();capture is an alias of track. Props are flat: strings, numbers, booleans or null. Keys that look like secrets
(password, token, authorization, …) are replaced with <redacted> on the device. See
Users and identify.
5. Mark private views
Section titled “5. Mark private views”Text inputs are always masked in replay. Mask anything else that shows private data:
const ref = useRef<View>(null);useEffect(() => Quameleon.markSensitive(ref), []);return <View ref={ref}>{/* account balance */}</View>;Give tappable views a testID: it becomes the tap target in analytics, the node id in the hierarchy and the handle
for QA assertions.
6. QA runs
Section titled “6. QA runs”The same build can be driven by a test host. Build a QA variant (expo run:android --variant release, or a QA EAS
profile without production: true), install it, and record a session:
npm i -D @quameleon/qa-hostnpx quameleon-qa doctornpx quameleon-qa record --android-serial emulator-5554 --package com.acme.app --out runs/1 --replaynpx quameleon-qa replay runs/1 --openContinue with Assertions and the CLI.
Scripted tests on Android and iOS
Section titled “Scripted tests on Android and iOS”One scripted test runs on both platforms (app.android and app.ios in the file):
npx quameleon-qa test qa-tests --android-serial emulator-5554npx quameleon-qa test qa-tests --ios-udid bootedOn Android the SDK injects real touches, which React Native’s touch system handles like a finger, into the top-most
window under the target, so a Modal (a separate Dialog window) gets them and back closes it through
onRequestClose. iOS has no public touch injection, and Pressables / Touchables only answer real touches, so on iOS
the native SDK hands React Native views to the JS SDK: it finds the component for the views under the point through
the React fiber tree (their React tags, else the step’s testID) and calls what a finger lift would:
onPressIn, onPressOut, onPress (onLongPress for long_press). A disabled component does nothing.
Alert.alert buttons work on iOS 26 too: Cancel through the alert’s Escape key command, any other button through
the JS SDK, which keeps the last alert’s buttons and calls the onPress after the native alert is dismissed.
react-native-pager-view / material top tabs switch pages on a horizontal swipe and RefreshControl refreshes on a
swipe down at the top of the list. Text goes through the native TextInput like the keyboard (onChangeText and onSubmitEditing fire); when no native
input is focused, the focused TextInput’s onChangeText / onSubmitEditing are called from JS. ScrollView and
FlatList scroll natively. This path exists only in QA mode, never in production.
Components that handle touches without an onPress / onLongPress prop (raw onResponder* handlers, Gesture Handler
gestures) can’t be driven on iOS; on Android they get real touches. disabled sets enabled: false in the hierarchy
and steps wait up to 2 s for it to clear, so a button enabled by a response is tapped once it re-renders.
Expo-specific notes
Section titled “Expo-specific notes”- Expo 55+ replaces global
fetchwith Expo’s own module. Quameleon hooks both the JSfetchwrapper and the native client, so requests are captured either way. EXPO_PUBLIC_*values are inlined at bundle time. Rebuild after changing the key or endpoint.- The Android emulator reaches a backend on your computer at
http://10.0.2.2:<port>; plainhttpis accepted only for127.0.0.1,localhostand10.0.2.2.