@pruva/react-native brings the verification widget into a React Native app. You get the same flow as the web widget, liveness, capture, and submission, presented in a full screen modal, with the result delivered to native callbacks.
The widget runs inside a secure WebView served from Pruva. The camera, the liveness detection, and the capture all happen in that WebView, so nothing sensitive is reimplemented in your app, and improvements to the widget reach your app without an SDK update.
Works in Expo (development and EAS builds) and bare React Native. It does not run in Expo Go, which cannot grant the native camera access a WebView needs. Use a development build.
Install
react-native-webview is a peer dependency; install it in your app. On bare React Native iOS, run pod install afterwards:
Camera permission
The widget needs the camera. The SDK grants the in-WebView camera request for you, but your app must hold the OS camera permission. This is the one platform step you cannot skip.- Bare React Native
- Expo
iOS, in Android, in
ios/YourApp/Info.plist:android/app/src/main/AndroidManifest.xml:Usage
The SDK offers two equivalent ways to open the widget: a hook, or a component.open(), close(), and a PruvaModal component to render once. The component version is controlled: you own the visible state.
Props
string
required
Your public widget key (
pub_...). Safe to ship in an app binary.boolean
Controls the modal. Component only; the hook manages this.
object
{ firstName, lastName, email }. Optional; prefills the flow and attaches to the result.string
Override the widget origin. Defaults to your Pruva app origin.
string
Override the API base the widget calls. Defaults to
https://api.pruva.africa.string
Hex color for the loading spinner, so it matches your brand from the first frame.
boolean
Show the live liveness numbers on screen, for testing.
Callbacks
function
({ widgetType }) when the widget has loaded and is ready.function
() when the user begins the flow.function
({ reference, result }) when a check finishes. reference is the verification id; result is passed, failed, or redirect.function
({ message }) on an error.function
({ completed }) once, when the modal dismisses. completed is true if a check finished, false if the user backed out.Confirm the result on your server
onComplete gives you a reference and a client side result. Treat your server as the source of truth: before you grant access or mark a user verified, confirm the outcome from your backend with the reference.
Public key, not API key
ThewidgetKey is a public key, built to live in a browser or an app binary. Never put a pruva_live_... API key in your app; that belongs on your server only. See Authentication.