React Native SDK
A guided native flow that collects the requested documents, runs the liveness challenge and location step, and sends the evidence for review. No WebView.
@credflare/sdk-react-native. It targets React Native 0.88.1 with React 19.3.0 and depends on the JavaScript SDK.Add the guided flow
import {CredflareVerification} from '@credflare/sdk-react-native';
async function sessionProvider() {
const response = await fetch('https://api.your-app.example/credflare/session', {
method: 'POST',
headers: {Authorization: 'Bearer ' + userToken},
});
return response.json(); // {session_id, token, api_base_url, expires_at}
}
<CredflareVerification
sessionProvider={sessionProvider}
onClose={() => navigation.goBack()}
onSubmitted={info => refreshStatus()}
/> sessionProvider calls your own authenticated backend, which creates the session as shown in the server example. The applicant presses Start and never sees a session ID or token.
| Prop | Purpose |
|---|---|
sessionProvider | Returns a session descriptor from your backend. Required. |
onClose | Called when the applicant closes the flow or presses Done. Required. |
onSubmitted | Called once nothing is left to collect. It receives the session info, not a decision. |
onCancelled | Called when the applicant leaves before finishing. The case stays open. |
onHostActionRequired | Called with {code} before onClose when nothing more can be done in the app: a leave rejection passes its code, and a receipt that leaves founders questions or other checks to your app passes null. |
autoStart | Skips the Start screen and loads the session at once. |
faceProvider | Replaces the face signal provider, for example in tests. It takes the same NativeFaceProvider shape as nativeFaceProvider. |
locator | Replaces the native location source. |
The flow asks the questions, collects the documents, then runs the case's facial, location, email and phone requirements in profile order, and ends with a receipt that lists what was received. Founders questions and other checks stay with your app, and the receipt tells the applicant so.
Liveness and location
- The facial step requests a liveness challenge, runs its gestures on the front camera, keeps a frame per gesture, records a video without sound when the profile asks for one, then takes the selfie.
- Face signals come from a camera output chosen per platform (
nativeFaceProvider). On iOS it uses Apple Vision through the SDK's own pod and reportsvision, with the same conversions as the Swift SDK. On Android it uses ML Kit throughreact-native-vision-camera-face-detectorand reportsmlkit.mlKitFaceProvideris a deprecated name fornativeFaceProvider. - The location step takes a high accuracy fix with
react-native-geolocation-service. Android reports the platform's mock flag. iOS sendsis_mock: null. - A rejected capture shows the rejection screen for its code. A challenge code starts over with a new challenge.
Questions and codes
- Every question type in the spec except
foundersis supported. A question whoseshow_ifdoes not match the answers so far is not shown, not checked and not sent. Countries are picked from a searchable list and sent as ISO codes. - The email and phone steps ask for the address or number, request a code, take the six digit code and confirm it. The resend link counts down from the last request.
- After every submission and code confirmation, the flow loads the session again and follows the refresh rule, so requirements a workflow adds are collected next.
- Every rejection with a code shows the shared rejection screen, with the requester's help contact.
Build your own screens
For a custom layout, use useCredflareSession(provider) to load the session and CredflareDocumentCapture for one document. The capture component keeps upload IDs and retry keys after a failed send, so keep it mounted while the applicant retries.
<CredflareDocumentCapture
session={session}
requirement={requirement}
requesterName={info.requester?.name}
maxFileSizeBytes={info.upload_limits.max_file_size_bytes}
allowedFileTypes={info.upload_limits.allowed_file_types}
onSubmitted={submissionId => reloadRequirements()}
onDirtyChanged={hasUnsentFiles => setGuardLeave(hasUnsentFiles)}
/> Configure the app
Add these as direct dependencies of your app so their native modules are linked, then run pod installation for iOS.
| Package | Version | Used for |
|---|---|---|
react-native-image-picker | 8.3.0 | Document photos |
@react-native-documents/picker | 12.1.0 | Saved files |
react-native-get-random-values | 2.1.0 | Request keys |
react-native-vision-camera | 5.2.4 | Liveness preview, gesture frames, video and selfie |
react-native-nitro-modules | 0.37.2 | Required by the camera packages |
react-native-nitro-image | 0.15.2 | Required by the camera |
react-native-vision-camera-face-detector | 2.1.0 | ML Kit face signals on Android |
react-native-geolocation-service | 5.3.1 | Location fixes |
react-native-svg | 15.16.1 | Icons |
- On iOS the face detector is not linked: ML Kit has no build for Apple silicon simulators, and the SDK reads faces with Apple Vision instead. Turn off its iOS linking in
react-native.config.js, then run pod installation:
module.exports = {
dependencies: {
'react-native-vision-camera-face-detector': { platforms: { ios: null } },
},
}; - The example app targets iOS 15.5.
- iOS
Info.plist:NSCameraUsageDescription,NSPhotoLibraryUsageDescriptionandNSLocationWhenInUseUsageDescription. The video has no sound, so no microphone permission is needed. - Android manifest:
android.permission.CAMERA,android.permission.ACCESS_FINE_LOCATIONandandroid.permission.ACCESS_COARSE_LOCATION. The SDK asks for location at runtime, and the camera package asks for the camera when liveness starts. - Bundle the Ubuntu fonts from the package's
assets/fontsfolder into your native font resources.
Read how the SDKs work for capture methods, receipts and error handling.