RecusAppProvider
The root provider component. Wrap your entire app with this once.
Import
import { RecusAppProvider } from 'recus-react-native'Props
| Prop | Type | Required | Description |
|---|---|---|---|
sdkKey | string | ✓ | Your publishable SDK key from the dashboard. Must start with pk_live_ or pk_test_. |
user | RecusUser | undefined | ✓ | Your authenticated user. Pass undefined when logged out. Recus is dormant when undefined. |
user.userId | string | ✓ | Your user's ID. This is the primary identifier Recus uses to track onboarding progress. |
user.email | string | — | User's email address. Shown in the Recus dashboard. |
user.name | string | — | User's display name. Available as {{user.name}} in flow content. |
children | ReactNode | ✓ | Your entire app. Recus never modifies your app's navigation or component tree. |
onComplete | (values: Record<string, any>) => void | — | Called when the user completes a flow. Receives all submitted field values. |
onSkip | (screenId: string) => void | — | Called when the user skips a screen. |
Full Example
import { RecusAppProvider } from 'recus-react-native'
export default function App() {
const { user } = useAuth()
const handleComplete = (values) => {
console.log('Onboarding complete:', values)
// values: { inp_name: "Jane", inp_role: "doctor", ... }
}
return (
<RecusAppProvider
sdkKey="pk_live_xxxxxxxxxxxxxxxxxxxx"
user={user ? {
userId: user.id,
email: user.email,
name: user.name,
plan: user.subscriptionPlan,
signedUp: user.createdAt,
} : undefined}
onComplete={handleComplete}
>
<YourApp />
</RecusAppProvider>
)
}Behaviour
When user is undefined
Recus does nothing. Your app renders normally. No API calls are made. Zero performance impact.
When user.userId is set
Recus checks if this user has completed the active mandatory flow. This check is instant on subsequent opens (cached locally). If onboarding is needed → flow appears above your app. If onboarding is done → nothing happens, Recus is invisible.
When the flow is completed
The flow disappears. Your app is visible. The completion state is cached locally. The user will never see this flow again on this device. onComplete is called with all submitted values.
If the Recus API is unavailable
Recus fails silently. Your app continues working normally. Onboarding will not show until the API is reachable again. This is by design — the SDK never breaks your app.