React Native SDK reference

Provider props, client options, hooks, and flow controls for @getuserfeedback/react-native.

Last reviewed

React Native SDK reference

This page documents the public API for @getuserfeedback/react-native. If you haven't set up the SDK yet, start with the React Native SDK guide.

The React Native API uses client.flow(flowId) for on-demand flows and useFlowContainer() with FlowContent for a custom native presentation. The browser React useFlow() hook is not part of this reference.

GetUserFeedbackProvider

Mount the provider above every component that calls useGetUserFeedback.

TypeScriptapp.tsx
import { GetUserFeedbackProvider } from "@getuserfeedback/react-native";export function App() {return (<GetUserFeedbackProvider clientOptions={{ apiKey: "YOUR_API_KEY" }}><AppRoutes /></GetUserFeedbackProvider>);}

Props

PropTypeDescription
childrenReactNodeApp content that can access the client.
clientOptionsClientOptionsPublic API key and initialization options. Required.
instanceIdstringDeprecated runtime identity override. Omit it and let the provider own runtime identity.
onError(error: Error) => voidReceives runtime and command errors.
webViewComponentNativeWebViewComponentOptional custom WebView component. It must forward received props and its ref to a compatible react-native-webview WebView whose ref exposes injectJavaScript.

ClientOptions

Pass these customer-facing options through the provider's clientOptions prop. Only apiKey is required.

OptionTypeDescription
apiKeystringYour project API key.
colorScheme"light" | "dark" | "system"Set a color scheme or follow the device setting with "system".
defaultConsentConsentConfigInitial consent decision or an explicit list of granted scopes.
disableTelemetrybooleanDisable anonymous performance telemetry. This does not disable user analytics.
enableDebugboolean | string | string[]Enable debug logging globally or for selected namespaces.
flagsRecord<string, AppEventFlagValue> | AppEventFlag[]Feature flag evaluations supplied during initialization.
capabilitiesArray<string | AppEventCapability>Capabilities supported by the current app version. Use this for capability-based targeting.
actionsNativeActionRegistration[]Static custom actions implemented by the host app.

The package exports CapabilitiesInput, FlagsInput, and ConfigureOptions for app-owned configuration helpers.

For compatibility, ClientOptions still accepts the deprecated clientMeta and runtimeEndpoints overrides. Application code should omit both: the provider supplies canonical React Native metadata and uses the SDK's pinned runtime.

Actions (actions)

Register custom actions through clientOptions.actions. Definitions remain fixed for the provider's mounted lifetime, while matching handler functions can be refreshed. React Native does not support the browser open-url override. See Actions for setup and behavior.

useGetUserFeedback()

Returns the provider's client. The hook must be called below GetUserFeedbackProvider; otherwise it throws.

Client

MemberDescription
instanceIdDeprecated runtime identity. Do not persist or branch on this value.
configure(options, commandOptions?)Update colorScheme, consent, auth, or capabilities.
identify(userId, traits?, options?)Associate a user ID, traits, and optional external IDs with the current user.
identify(traits, options?)Associate traits without a user ID.
track(eventName, properties?, options?)Record a product event with optional external IDs. See Events.
screen(name, properties?, options?)Record the current application screen with optional external IDs. See Events.
graph.connect(relationship)Record that two product objects are connected.
graph.disconnect(relationship)Record that a recorded connection ended.
flow(flowId)Return a controller for one on-demand flow lifecycle.
close()Close every open flow owned by this provider.
onOpenRequested(callback)Observe persisted Flow opens before presentation. Call event.preventDefault() to keep an activation inactive. Returns an unsubscribe function.
reset(commandOptions?)Reset widget state and the current user identity.

The package also exports GraphOperations, GraphRelationship, and GraphRelationshipRef for typed relationship helpers.

For opt-in screen tracking from React Navigation, Expo Router, or another router, see React Native screen tracking. Current page path is a browser-only targeting condition. In React Native, target the screen occurrences recorded by screen() instead.

identify(), track(), and screen() return promises. Their options argument can carry external IDs. Client commands return promises, so await them or handle rejected promises where your app calls them.

The commandOptions accepted by legacy command signatures still permits a deprecated idempotencyKey. Omit it; the SDK owns command identity and transport correlation.

The three-argument traits-only form, identify(traits, undefined, options?), is also supported when a call site keeps options in the third argument.

client.onOpenRequested()

Register a synchronous observer for persisted Flow opens requested by an explicit flow().open() call or client-side targeting:

const unsubscribe = client.onOpenRequested((event) => {if (event.source === "targeting") {event.preventDefault();}});

The event includes source ("command" or "targeting") and flowId. Supplied Flow metadata without a persisted flowId does not emit this event. Call the returned function to unsubscribe.

client.flow(flowId)

Returns a FlowRun controller for one flow ID. Use the same controller when prefetching, prerendering, opening, and closing one flow lifecycle.

const client = useGetUserFeedback();void client.flow("YOUR_FLOW_ID").open().catch((error) => console.error("Unable to open feedback", error));

The flow must be published with Widget delivery and On-demand method. The package exports OpenFlowOptions and PrerenderFlowOptions for typed wrappers around these methods.

MemberDescription
flowIdThe flow ID passed to client.flow().
open(options?)Open the flow. Options are hideCloseButton and metadata. See Response metadata.
prefetch()Load the flow's network resources before opening.
prerender(options?)Load the flow and warm its UI before opening. The option is hideCloseButton.
close()Close this flow lifecycle.

All flow methods return promises. Use Open Widget flows from code for delivery and preparation patterns.

useFlowContainer()

Use this hook when your app owns the sheet, drawer, modal, or inline presentation around a flow. It must be called below GetUserFeedbackProvider.

Return valueDescription
isOpentrue when an active flow is visible.
isLoadingtrue when an active flow is waiting for its measured size.
shouldRenderContainertrue while your container should be visible, including while the flow is measuring.
close()Close every open flow owned by this provider. Returns a promise.

Render one FlowContent inside the customer-owned container. Keep it mounted while the container is closed so the projected flow can retain its state. See the Containers guide for the complete example.

FlowContent

FlowContent renders the active flow at its measured size inside your native container. Mount it below GetUserFeedbackProvider, and mount only one FlowContent for that provider. Do not render it conditionally with the container's open state.

When FlowContent is not mounted, active flows use the SDK's built-in overlay.