Requirements
React Native 0.72 or later, react-native-webview 13.8 or later, iOS 14.3 or later, Android 7.0 (API 24) or later.
Install
Take the react-native folder from the SDK archive, build the package and add it from the folder:
cd veriffy-sdk/react-native && npm install && npm run build
cd ../../your-app
npm install ../veriffy-sdk/react-native react-native-webview
cd ios && pod installCamera access
<key>NSCameraUsageDescription</key>
<string>We use the camera to photograph your ID document and take a selfie for identity verification.</string>
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
On Android the component asks for the permission itself before loading the verification. If the user has blocked the camera permanently, they see a screen with Open Settings, Try again and Close.
Usage
import { useState } from 'react';
import { Button } from 'react-native';
import { VeriffyModal } from '@veriffy/react-native';
export function VerifyButton() {
const [url, setUrl] = useState<string | null>(null);
async function start() {
const res = await fetch('https://your-backend.example.com/kyc/session', { method: 'POST' });
setUrl((await res.json()).url);
}
return (
<>
<Button title="Verify my identity" onPress={start} />
<VeriffyModal
visible={!!url}
url={url ?? ''}
onComplete={({ status }) => { setUrl(null); showPending(status); }}
onCancel={() => setUrl(null)}
onError={({ code }) => { setUrl(null); showError(code); }}
/>
</>
);
}| Prop | Description |
|---|---|
visible |
Whether the verification is shown |
url |
The url from your server |
onComplete |
({status, sessionId, reasons}) — the user submitted |
onCancel |
({sessionId}) — closed before submission |
onError |
({code, message, sessionId}) — closed on an error screen |
onEvent |
Every verification event |
If you remove the component yourself
When your code unmounts the component, no result is reported. If you need it, call ref.close() first.