The package @neurovision/react-native-kyc runs the session in the native SDKs (Android ru.neurovision.kyc:kyc-sdk, iOS NeuroVisionKyc); the result comes back to JavaScript.
Requirements
| React Native |
| Android |
| iOS |
| Expo |
Installation
Until the package is on npm, it comes in the SDK package: the package itself as sdk/react-native/neurovision-react-native-kyc-0.6.2.tgz, the Android SDK it depends on in sdk/android/maven/.
1. Copy both into your project, e.g. into third_party/.
2. Install the package from the tarball:
npm install ./third_party/neurovision-react-native-kyc-0.6.2.tgz 3. The Android SDK from the Maven folder — in android/build.gradle:
allprojects {
repositories {
maven {
url = new File(rootProject.projectDir, "../third_party/neurovision-maven").toURI()
content { includeGroup("ru.neurovision.kyc") }
}
}
} 4. iOS: cd ios && pod install.
The package carries the iOS framework: there is nothing else to fetch for iOS. Once the package is on npm, the tarball becomes a version and the maven { … } block goes.
Android
Set minSdkVersion = 26 in the ext block of the app's android/build.gradle.
The native SDK ships for arm64-v8a and armeabi-v7a. A React Native app carries x86_64 libraries of its own, so on an x86_64 device or emulator it runs as x86_64 and the session does not start: start returns { kind: 'failed', reason: 'unsupportedDevice' } at once — show the user that this device is not supported. Test on an arm64 emulator or a device.
MainActivity's launchMode. The React Native template sets singleTask. With it, if the user leaves the app during the session and comes back through the launcher icon, the session is lost (cancelled). Use singleTop (or the default standard) unless the app needs singleTask for deep links.
iOS
Keep React Native's own line platform :ios, min_ios_version_supported in the Podfile (15.1, above the SDK's minimum of 15.0) and add the camera usage text to Info.plist:
<key>NSCameraUsageDescription</key>
<string>The camera photographs your document and films the liveness check.</string> Static linkage (the default) works; so does USE_FRAMEWORKS=static|dynamic in Release. A Debug build with USE_FRAMEWORKS does not link in React Native 0.87.1: the missing symbols are React Native's own (Fabric and Hermes debug code), not this package's.
Usage
import { NeuroVisionKyc, KycError, type KycResult } from '@neurovision/react-native-kyc';
try {
const result: KycResult = await NeuroVisionKyc.start({
apiHost: apiHost, // the address NeuroVision sent you
schemaId,
clientKey, // from your server
clientUser: userId, // optional: your user's id, the same in all their checks
language: 'en', // optional; default: the scenario's
theme: 'auto', // optional: 'auto' | 'light' | 'dark'
});
// or: NeuroVisionKyc.start({ apiHost, taskId, clientUser: userId })
switch (result.kind) {
case 'completed': // the server judged the session
console.log(result.verdict); // 'success' | 'failed' | 'suspicious' | 'expired' | 'unknown'
break;
case 'cancelled': // the user left before the end
break;
case 'failed': // the session could not go on
console.log(result.reason, result.message);
// 'cameraDenied' | 'network' | 'server' | 'camera' | 'config' | 'unsupportedDevice' | 'internal'
break;
}
} catch (e) {
if (e instanceof KycError) {
// misuse, never a session's outcome:
// 'already_running' | 'bad_request' | 'no_activity' (Android) | 'no_view_controller' (iOS)
}
}
NeuroVisionKyc.sdkVersion(); // the native SDK's version, synchronously Every outcome of a session — a cancel, a refused camera, no network — is a KycResult, not an exception. Values a newer SDK may add are read as verdict: 'unknown' / reason: 'internal'.
What each result means and what to show the user — Results. Where the request's values come from — Server integration.
Refusals
KycError already_running |
KycError bad_request |
{ kind: 'failed', reason: 'config' } |
{ kind: 'failed', reason: 'unsupportedDevice' } |
Analytics (optional)
The SDK can send product analytics to the PostHog project your app names in its native settings; the SDK itself carries no key. Android — android/app/src/main/AndroidManifest.xml:
<application …>
<meta-data android:name="NeuroVisionKycPostHogKey" android:value="phc_…" />
<meta-data android:name="NeuroVisionKycPostHogHost" android:value="https://us.i.posthog.com" />
</application> iOS — ios/<App>/Info.plist:
<key>NeuroVisionKycPostHogKey</key>
<string>phc_…</string>
<key>NeuroVisionKycPostHogHost</key>
<string>https://us.i.posthog.com</string> Without a key the SDK sends no analytics. Keep the key out of git: manifest placeholders filled from android/gradle.properties or the environment, and $(KYC_POSTHOG_KEY) in Info.plist from the environment of the iOS build. What is sent — Analytics and privacy.
Limits
- The session is a full-screen native screen (an Android activity, an iOS modal controller); it cannot be embedded in the component tree.
- If Android kills the app's process while the session is on screen, the result is lost: the app restarts without the pending promise.
- A JavaScript reload (development only) while the session is on screen: on iOS the session is closed and its result dropped; on Android the reload does not reach the paused app until the session ends.