Skip to content

JavaScript API (React Native)

import Quameleon, { QuameleonErrorBoundary, useQuameleonActive, useQuameleonWebView,
QuameleonTracerProvider } from "@quameleon/qa-react-native";

Every call is safe to make while the SDK is dormant: it is a no-op and never throws.

Call Returns Notes
startProduction(config) boolean Starts production mode. True when capturing; false when QA mode is active, the config is invalid, the session was not sampled or the kill switch is on. See config options.
isActive() boolean True in QA mode or production mode
isProduction() boolean True in production mode
configure(partial) void Switches capture categories and tuning; see configuration
Call Notes
identify(distinctId, props?) Emits context user.id and context person, persists distinct_id across launches. See Users and identify.
reset() Clears distinct_id (sign-out); in production also starts a new session and user session
capture(event, props?) Alias of track
Call Notes
track(name, props?) event signal
log(name, props?) log signal
screen(name, route?) screen signal; sets the current screen
trackNavigation(navRef) React Navigation / Expo Router: a screen signal per route change. Returns stop.
trackWixNavigation(Navigation) react-native-navigation (Wix). Returns stop.
reduxMiddleware Redux middleware: an event redux.action per dispatched action type
Call Notes
setUser(id | null) context user.id. Prefer identify from 0.5.
setAttribute(key, value) context <key>; null clears
setFeatureFlag(name, variant | null) context flag.<name>; kept with crash markers
Call Notes
reportError(error, props?) A handled error: error {handled: true, fatal: false}
<QuameleonErrorBoundary name fallback onError> Reports render errors with boundary and component_stack, then renders fallback (a node, or (error, reset) => node)
reportBug(description, props?) bug_report signal plus a masked screenshot
lastExit() The previous run’s exit ({reason, timestamp, …}) or null

Unhandled JS errors and promise rejections are captured automatically. A fatal JS error is flushed and persisted before the native crash it causes, which is then linked with js_error_id.

fetch, XHR and Expo’s fetch are captured automatically. For requests the hooks cannot see:

Quameleon.recordNetwork({ method: "GET", url: "https://api.example.com/feed", status: 200, duration_ms: 182 });

ManualNetwork fields: method, url, status, duration_ms (or startTime / endTime in epoch ms), error, request_id, props.

Call Notes
startSpan(name, opts?) Returns a Span: setAttribute, addEvent, checkpoint, setStatus, recordException, updateName, isRecording, end(status?). Ids are W3C hex.
span(name, fn, opts?) Runs fn in a span (status error if it throws); fetches started inside join its trace
recordSpan(name, start, end, opts?) A span that already happened (epoch ms)
withActiveSpan(span, fn) Runs fn with span active
QuameleonTracerProvider An OpenTelemetry TracerProvider over startSpan

SpanOptions: parent, attributes, startTime, root. With traceparent_hosts configured, requests to those hosts carry a traceparent header for the active span.

Call Notes
markSensitive(refOrTag) Masks the view and its subtree in replay and screenshots. Returns unmark.
Call Notes
probe(name, fn) Registers a read-only probe the host can query (q.probe(name)). fn returns a primitive or a promise of one. Returns unregister.
useQuameleonActive() React hook: whether the SDK is active
const webProps = useQuameleonWebView({ allowedOrigins: ["https://shop.example.com"] });
return <WebView source={{ uri }} {...webProps} />;

webViewProps(opts) is the non-hook form. Pages on allowed origins post taps, errors and network through qa-web; their DOM is spliced into the hierarchy and their inputs are masked.