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 useFlow() or client.flow(flowId) for on-demand
flows and useFlowContainer() with FlowContent for a custom native
presentation.
GetUserFeedbackProvider
Mount the provider above every component that calls useGetUserFeedback.
import { GetUserFeedbackProvider } from "@getuserfeedback/react-native";export function App() {return (<GetUserFeedbackProvider clientOptions={{ apiKey: "YOUR_API_KEY" }}><AppRoutes /></GetUserFeedbackProvider>);}Props
| Prop | Type | Description |
|---|---|---|
children | ReactNode | App content that can access the client. |
clientOptions | ClientOptions | Public API key and initialization options. Required. |
instanceId | string | Deprecated runtime identity override. Omit it and let the provider own runtime identity. |
onError | (error: Error) => void | Receives runtime and command errors. |
webViewComponent | NativeWebViewComponent | Optional 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.
| Option | Type | Description |
|---|---|---|
apiKey | string | Your project API key. |
colorScheme | "light" | "dark" | "system" | Set a color scheme or follow the device setting with "system". |
defaultConsent | ConsentConfig | Initial consent decision or an explicit list of granted scopes. |
disableTelemetry | boolean | Disable anonymous performance telemetry. This does not disable user analytics. |
enableDebug | boolean | string | string[] | Enable debug logging globally or for selected namespaces. |
flags | Record<string, AppEventFlagValue> | AppEventFlag[] | Feature flag evaluations supplied during initialization. |
capabilities | Array<string | AppEventCapability> | Capabilities supported by the current app version. Use this for capability-based targeting. |
links | LinksConfig | Synchronously route authored HTTP(S) links in the host app. |
actions | ActionsConfig | NativeActionRegistration[] | Static custom actions. Prefer ActionsConfig. |
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.
Links (links)
Provide a synchronous router when your app owns link navigation:
<GetUserFeedbackProviderclientOptions={{apiKey: "YOUR_API_KEY",links: {router: ({ url }) => {appRouter.navigate(url);},},}}><App /></GetUserFeedbackProvider>The router receives url and the authored target ("self" or "blank",
when available). It must claim the request synchronously and return undefined.
Throwing or returning a promise-like value is terminal failure. Keep
clientOptions.links.router present for the provider's mounted lifetime. Its
function may change between renders, but adding or removing it after the client
initializes throws. Without links, authored links are unavailable in React
Native.
Actions (actions)
Register custom actions through clientOptions.actions. Definitions remain
fixed for the provider's mounted lifetime, while the handler can be refreshed.
React Native does not support the legacy browser open-url registration.
See Actions for setup and behavior.
useGetUserFeedback()
Returns the provider's client. The hook must be called below
GetUserFeedbackProvider; otherwise it throws.
Client
| Member | Description |
|---|---|
instanceId | Deprecated 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?) | Asynchronously close open flows, clear JWT authentication, and reset the current user identity. Other runtime configuration remains in place. |
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() accept external IDs through their
options argument. Some invalid input can throw before a command promise is
returned; other validation or command-processing failures reject that promise.
Use try/catch around an awaited call to handle both. See
Events for the shared pattern.
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.
| Member | Description |
|---|---|
flowId | The 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.
useFlow(options)
Use this hook for reactive state and commands for one on-demand flow:
const { open, close, prefetch, prerender, isOpen, isLoading } = useFlow({flowId: "YOUR_FLOW_ID",});Options are flowId, prefetchOnMount, and hideCloseButton. open() also
accepts response metadata. The hook exposes the same open(), close(),
prefetch(), and prerender() operations as client.flow(flowId).
React Native custom presentation remains provider-wide: use
useFlowContainer() and render one FlowContent rather than passing a
per-flow container to useFlow().
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 value | Description |
|---|---|
isOpen | true when an active flow is visible. |
isLoading | true when an active flow is waiting for its measured size. |
shouldRenderContainer | true 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.