VLens Library is a React-based SDK for integrating VLens functionalities into your applications.
To install the VLens Library, use npm or yarn:
npm install react-native-vlens
npm install react-native-vision-camera react-native-vision-camera-face-detector react-native-worklets-core react-native-reanimated react-native-fs react-native-image-resizer react-native-sound-player
Then add the VisionCamera plugin to your Expo config (app.json, app.config.json or app.config.js): More details here.
{
"name": "my app",
"plugins": [
[
"react-native-vision-camera",
{
"cameraPermissionText": "$(PRODUCT_NAME) needs access to your Camera."
}
]
]
}
Finally, compile the mods:
npm expo prebuild
Here is a basic example of how to use the VLens Library in your React application:
import VLensView from 'react-native-vlens';
<VLensView
transactionId={transactionId}
isLivenessOnly={false}
isNationalIdOnly={false}
env={{
apiBaseUrl: 'https://api.vlenseg.com',
accessToken: accessToken,
refreshToken: '',
apiKey: _apiKey,
tenancyName: _telencyName,
}}
defaultLocale={'en'}
colors={{
accent: '#4E5A78',
primary: '#397374',
secondary: '#AF9759',
background: '#FEFEFE',
dark: '#000000',
light: '#FFFFFF',
}}
errorMessages={[]} // Coming soon
onSuccess={onVLensSuccess}
onFaild={onVLensFaild}
/>
-
transactionId
- Type:
string
- Description: A unique identifier for the transaction.
- Type:
-
isLivenessOnly
- Type:
boolean
- Description: If
true
, only the liveness detection will be performed.
- Type:
-
env
- Type:
object
- Description: Environment configuration containing API details.
- Fields:
- apiBaseUrl: Base URL for the VLens API.
- accessToken: Authorization token for API access.
- refreshToken: Token for refreshing the session (if applicable).
- apiKey: API key for authentication.
- tenancyName: The tenant's name for identification.
- Type:
-
onSuccess
- Type:
function
- Description: Callback invoked when the operation succeeds.
- Arguments:
- Response object containing success details.
- Type:
-
onFaild
- Type:
function
- Description: Callback invoked when the operation fails.
- Arguments:
- Response object containing error details.
- Type:
-
isNationalIdOnly
- Type:
boolean
- Default:
false
- Description: If
true
, only national ID scanning will be performed.
- Type:
-
defaultLocale
- Type:
string
- Default:
'en'
- Description: Sets the default language for the component (e.g.,
'en'
for English).
- Type:
-
colors
- Type:
object
- Description: Customize the color palette for the component's UI.
- Fields:
- accent: Accent color.
- primary: Primary color.
- secondary: Secondary color.
- background: Background color.
- dark: Dark theme color.
- light: Light theme color.
- Type:
-
errorMessages
- Type:
array
- Default:
[]
- Description: Custom error messages for specific scenarios. (Coming soon)
- Type:
-
onSuccess(response)
- Triggered when the operation is successful.
-
response
: Contains the result data.
-
onFaild(error)
- Triggered when the operation fails.
-
error
: Contains error details.
- Ensure all required props are properly configured to avoid unexpected behavior.
- Customize the
colors
prop to match the application's theme. - The
errorMessages
feature is planned for future updates and is currently a placeholder.
The colors
prop allows you to control the UI theme. For example:
colors={{
accent: '#4E5A78',
primary: '#397374',
secondary: '#AF9759',
background: '#FEFEFE',
dark: '#000000',
light: '#FFFFFF',
}}
For any questions or support, please contact us at support@vlenseg.com.