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 API, including useFlow() and the actions option, is not part
of this reference.
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 | Stable identifier for this provider instance. A value is created when omitted or blank. |
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 | AppEventFlag[] | Feature flag evaluations supplied during initialization. |
capabilities | Array<string | AppEventCapability> | Capabilities supported by the current app version. Use this for capability-based targeting. |
The React Native option is named capabilities. Do not pass the browser React
SDK's actions option.
useGetUserFeedback()
Returns the provider's client. The hook must be called below
GetUserFeedbackProvider; otherwise it throws.
Client
| Member | Description |
|---|---|
instanceId | The stable identifier for this provider instance. |
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. |
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. |
reset(commandOptions?) | Reset widget state and the current user identity. |
updateHostContext(context, commandOptions?) | Send the current host context to the runtime. |
emitHostSignal(name, data?, commandOptions?) | Send a named host signal to the runtime. |
identify() and track() 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 three-argument traits-only form, identify(traits, undefined, options?),
is also supported when a call site keeps options in the third argument.
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.
| 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.
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.