Skip to main content

React Native SDK API reference

Current package: @superflag-sh/react-native@0.4.0.

SuperflagProvider

Important props:

Hooks

Use useBooleanFlag, useStringFlag, useNumberFlag, and useObjectFlag for value reads. Each has a details counterpart. useFlag remains compatible. useFlags() returns readiness/loading flags, status, source, error, fetchedAt, config version, age, stale state, and coalesced refresh. It does not return app/environment identity or the evaluation context. useSuperflagClient() exposes typed reads plus track, flush, shutdown, and refresh. createTypedHooks<ValueMap>(), useTypedFlag, and the imperative createSuperflagClient export preserve key/value relationships outside the basic hooks.

Cache and lifecycle contract

AsyncStorage is loaded lazily and native storage failures are contained. The shared @superflag-sh/core/cache Module owns the same endpoint/key/app/environment identity Interface as React; this Adapter owns native persistence and lifecycle. Raw keys are never persisted. ETag/304 revalidation, hard-stale bounds, authentication failure, source identity checks, config-version rollback protection, and legacy-to-core normalization match the browser SDK. Provider teardown removes subscriptions and timers and aborts guarded fetches.

Telemetry contract

Hosted telemetry is opt-in. Value reads expose once; details reads decide without creating a false exposure. track(flagKey, metricKey, value?) requires a current targeting identity and prior value exposure. The exposure association is intentionally in memory, while accepted queue entries persist.