Add to package.json
file under dependencies
group:
"react-native-trust-vision-SDK": "git+https://<github_token>:[email protected]/tsocial/<repo_name>#<version_tag_name>"
$ yarn
...
pod 'RNTrustVisionRnsdkFramework', path: '../node_modules/react-native-trust-vision-SDK'
...
# Add below lines to the end of podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -no-verify-emitted-module-interface'
end
// you can add more modules which have the error "Undefined symbol" into the list
if ['CocoaLumberjack', 'TensorFlowLiteC', 'TensorFlowLiteSwift', 'PromiseKit', 'CryptoSwift'].include? "#{target}"
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end
end
$ pod install
Add to root-level build.gradle
file (host app):
maven {
url("$rootDir/../node_modules/react-native-trust-vision-SDK/android/repo")
}
eg:
allprojects {
repositories {
mavenLocal()
...
maven {
url("$rootDir/../node_modules/react-native-trust-vision-SDK/android/repo")
}
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
Add to app/build.gradle
android {
...
aaptOptions {
noCompress "tflite"
noCompress "lite"
}
}
import { NativeEventEmitter } from "react-native";
import RNTrustVisionRnsdkFramework, {
TVConst,
TVErrorCode,
TVThemeCustomization,
} from "react-native-trust-vision-SDK";
Full steps:
try {
const initConfig = {
jsonConfigurationByServer: jsonConfigurationByServer,
languageCode: languageCode,
};
await RNTrustVisionRnsdkFramework.initializeWithConfig(initConfig);
const tvsdkEmitter = new NativeEventEmitter(RNTrustVisionRnsdkFramework);
// Listen to the events during the capturing
const subscription = tvsdkEmitter.addListener("TVSDKEvent", (event) => {
console.log("TVSDK - " + event.name + " - " + event.params.page_name);
});
const selfieConfig = {
cameraOption: TVConst.SelfieCameraMode.FRONT,
livenessMode: TVConst.LivenessMode.FLASH_ADVANCED,
skipConfirmScreen: true,
isEnableSound: false,
};
const faceAuthConfig = {
cusUserId: "cusUserId",
authType: TVConst.AuthenType.REGISTRATION,
authMode: TVConst.AuthenMode.FLASH_8,
selfieConfig: selfieConfig,
};
const faceAuthResult =
await RNTrustVisionRnsdkFramework.startFaceAuthentication(faceAuthConfig);
} catch (e) {}
SDK needs to be initialized first
const initConfig = {
jsonConfigurationByServer: jsonConfigurationByServer,
languageCode: languageCode,
theme: theme,
endpoint: endpoint,
accessKeyId: accessKeyId,
accessKeySecret: accessKeySecret,
endpointLogger: endpointLogger,
accessKeyIdLogger: accessKeyIdLogger,
accessKeySecretLogger: accessKeySecretLogger,
xRequestId: xRequestId,
xRequestId2: xRequestId2,
imageEncryptionKey: imageEncryptionKey,
securityPublicKey: securityPublicKey,
flowId: flowId,
headers: headers,
};
await RNTrustVisionRnsdkFramework.initializeWithConfig(initConfig);
Options:
String
the code of the language that will show and sound to user. E.g Vietnamese (vi), English (
en).String
(optional). the key to encrypt image data. It's optional. If it's null or empty then the image data
will not be encrypted.String
(optional). the key to encrypt exif data. It's optional. If it's null or empty then the exif data
will be encrypted by the default key.TVTheme
(optional). The theme of the SDK. If it's null then the sdk will use the default theme or
the theme that we customized for the client.To call the APIs in the SDK, the host app needs to set the following parameters:
String
. The endpoint of the server.String
. The access key id of the server.String
. The secret key of the server.String
(optional) https://ekyc.trustingsocial.com/api-reference/customer-api#api-reconciliationString
(optional)Map<String, String>
(optional). The headers to be added to the request.String
(optional). The flow id of the APIThe host app will call the APIs itself, set the following parameters:
String
. set this parameter if the host app will call the APIs itself. The jsonConfigurationByServer
is the setting specialized for each client from TS server.
It's the response json string get by
API https://ekyc.trustingsocial.com/api-reference/customer-api/#get-client-settings.
When it's null or unmatched with the expected type then the default setting in the SDK will be used.If the log event feature is used, set the following parameters:
String
. The endpoint of the log event server.String
. The access key id of the log event server.String
. The secret key of the log event server.The SDK provides some built in functions to capture id, selfie, liveness...
const idConfig = {
cardTypes: [cardType],
cardSide: TVConst.CardSide.FRONT,
isEnableSound: true,
isReadBothSide: false,
skipConfirmScreen: true,
isEnablePhotoGalleryPicker: false,
isEnableUploadFrames: true,
isEnableUploadImages: true,
isEnableSanityCheck: true,
isEnableDetectingIdCardTampering: true,
isEnableReadCardInfo: true,
isEnableCheckNfcData: true,
isEnableVerifyNfc: true,
};
Options:
[CardType]
. Card types is allowed capture. List of supported cards can be found by RNTrustVisionRnsdkFramework.cardTypes
after you initialize the SDK with the clientSettingsJsonString. If not, use :const cardType = {
id: "vn.national_id",
name: "CMND cũ / CMND mới / CCCD",
orientation: TVConst.Orientation.HORIZONTAL,
hasBackSide: true,
frontQr: {
exist: true,
type: "qr_code",
widthHeightRatio: 1,
},
};
TVConst.CardSide
. Card sidebool
. Sound is played or notbool
. Read both sides of id card or notbool
. Skip confirmation screen or notbool
. Allow user select id card image from phone gallerybool
. Allow user scan QR code or notbool
. Allow user scan NFC or notboolean
. Enable upload video frames or not. If it's false then the SDK won't call the API to upload
the frames and the APIs that need the video frames will be skipped or called with empty frames data.boolean
. Enable upload images or not. If it's false then the SDK won't call the API to upload
the images and the APIs that need the image will be skipped.boolean
. Enable sanity check or not. If it's true then the SDK will call
the API to check the sanity of the id card.boolean
. Enable ID Tampering Verification or not. If it's true then the SDK
will call the API to
check the tampering of the id card.boolean
. Enable read card info or not. If it's true then the SDK will call
the API to read the card info.boolean
. Enable check NFC data or not. If it's true then the SDK will call
the API to get sod and cached fields of the NFC data.boolean
. Enable verify NFC or not. If it's true then the SDK will call
the API to verify the NFC.const result = await RNTrustVisionRnsdkFramework.startIdCapturing(config);
If the APIs is called by the SDK, please skip the image upload step.
if result.frontIdQr.is_required
is true then result.frontIdQr.images
array should be non-empty. Otherwise, clients should be warned to re-capture id card photos.
QR imagegs will be uploaded with this api: https://ekyc.trustingsocial.com/api-reference/customer-api/#upload-image
result.frontIdQr.images[i].raw_image_base64
result.frontIdQr.images[i].label
result.frontIdQr.images[i].metadata
*The same logic will be applied to result.backIdQr
const config = {
cameraOption: TVConst.SelfieCameraMode.FRONT,
isEnableSound: true,
livenessMode: TVConst.LivenessMode.FLASH_16,
skipConfirmScreen: true,
isEnableUploadFrames: true,
isEnableUploadImages: true,
isEnableSanityCheck: true,
isEnableVerifyLiveness: true,
};
Options:
TVConst.SelfieCameraMode
. Camera optionbool
. Sound is played or notTVConst.LivenessMode
. Liveness modebool
. Skip confirmation screen or notboolean
. Enable upload video frames or not. If it's false then
the SDK won't call the API to upload the frames and the APIs that need the video frames will be skipped or called with empty frames data.boolean
. Enable upload images or not. If it's false then
the SDK won't call the API to upload the images and the APIs that need the image will be skipped.boolean
. Enable sanity check or not. If it's true then the SDK will call
the API to check the sanity of the selfie.boolean
. Enable liveness verification or not. If it's true
then the SDK will call the API to verify the liveness of the selfie.const selfieCapturingResult =
await RNTrustVisionRnsdkFramework.startSelfieCapturing(config);
If the APIs is called by the SDK, please skip this step.
Note: Ignore this section if Frame recording is disabled by client settings.
var frameBatchIdsDictionary = []; // this dictionary will be used for liveness verification
// frameBatchIdsDictionary.push({
// key: <id_returned_from_sdk>,
// value: <id_returned_from_server>
// });
// Listen to the frame batches recorded during the capturing
const framesRecordedSubscription = tvsdkEmitter.addListener(
"TVSDKFrameBatch",
async (frameBatch) => {
console.log("TVSDK - " + "FrameBatch: ", frameBatch);
// upload frame batch to server using this api:
// https://ekyc.trustingsocial.com/api-reference/customer-api/#upload-videoaudioframes
const uploadingResult = await uploadFrameBatch(frameBatch);
frameBatchIdsDictionary.push({
key: frameBatch.batchId,
value: uploadingResult.fileId,
});
}
);
If the APIs is called by the SDK, please skip this step.
Note: Ignore this section if Frame recording is disabled by client settings.
Only frame batches of Selfie capturing which id is containing in selfieCapturingResult.livenessFrameBatchIds
are valid to be used for liveness verification.
// Remove all invalid batch ids:
Object.entries(frameBatchIdsDictionary).map(
([id_returned_from_sdk, id_returned_from_server]) => {
if (
!selfieCapturingResult.livenessFrameBatchIds.includes(
id_returned_from_sdk
)
) {
delete frameBatchIdsDictionary[id_returned_from_sdk];
}
}
);
https://ekyc.trustingsocial.com/api-reference/customer-api/#upload-image
id of frontal image i = image id of selfieCapturingResult.selfieImages[i].frontal_image.raw_image_base64
id of gesture image i = image id of selfieCapturingResult.selfieImages[i].gesture_image.raw_image_base64
https://ekyc.trustingsocial.com/api-reference/customer-api/#verify-face-liveness with params
images
field, each element contains:{
"id": "<id of frontal image i>"
}
gesture_images
field, each element contains:{
"gesture": "lower case string of <selfieCapturingResult.selfieImages[i].gesture_type>",
"images": [
{
"id": "<id of gesture image i>"
}
]
}
videos
field is the list of frame batch ids returned from server, which are the values of frameBatchIdsDictionary
Note: Ignore this field if Frame recording is disabled by client settings.{
"id": "<frameBatchIdsDictionary's values[0]>"
},
{
"id": "<frameBatchIdsDictionary's values[1]>"
}
...
metadata
field is selfieCapturingResult.livenessMetadata
const config = {
cardType: cardType,
isEnableSound: false,
skipConfirmScreen: true,
cardSide: TVConst.CardSide.FRONT,
isEnableUploadFrames: true,
isEnableUploadImages: true,
};
Options:
CardType
. Card typeTVConst.CardSide
. Card sidebool
. Sound is played or notbool
. Skip confirmation screen or notboolean
. Enable upload video frames or notboolean
. Enable upload images or notconst result = await RNTrustVisionRnsdkFramework.startQRScanning(config);
If the APIs is called by the SDK, please skip this step.
if result.frontIdQr.isRequired
is true then result.frontIdQr.images
array should be non-empty. Otherwise, clients should be warned to re-scan QR code.
QR images will be uploaded with this api: https://ekyc.trustingsocial.com/api-reference/customer-api/#upload-image
const frontQrImage = result.frontIdQr.images[i];
const metadata = frontQrImage.metadata;
const label = frontQrImage.label;
const data = frontQrImage.imageByteArray;
*The same logic will be applied to result.backIdQr
const config = {
nfcCode: nfcCode,
hashSod: sod,
issueDate: issueDate,
cachedFields: cachedFields,
isRequestReadImageNfc: true,
isRequestIntegrityCheckNfc: true,
isRequestCloneDetectionNfc: true,
nfcMaxRetries: 5,
isEnableCheckNfcData: true,
isEnableVerifyNfc: true,
};
Options:
String
is the id number of ID cardString
(optional) is the hash of SODString
(optional) is the issue date of ID card (DD/MM/YYYY)List<String>
(optional) is the list of fields that was cached from previous scanningboolean
(optional) read image in the chip when scan nfc or notboolean
(optional) check integrity of the chip when scanning nfc or notboolean
(optional) check clone of the chip when scanning nfc or notInt
. (optional) The maximum number of times the SDK retries an NFC scanning before giving upboolean
. Enable check NFC data or not. If it's true then the SDK will call
the API to get sod and cached fields of the NFC data.boolean
. Enable verify NFC or not. If it's true then the SDK will call
the API to verify the NFC data.const result = await RNTrustVisionRnsdkFramework.startNfcScanning(config);
const selfieConfig = {
cameraOption: TVConst.SelfieCameraMode.FRONT,
livenessMode: TVConst.LivenessMode.FLASH_ADVANCED,
skipConfirmScreen: true,
isEnableSound: false,
};
const config = {
cusUserId: "cusUserId",
authType: TVConst.AuthenType.REGISTRATION,
authMode: TVConst.AuthenMode.FLASH_ADVANCED,
isEnableFaceAuthentication: true,
isEnableFaceRegistration: true,
selfieConfig: selfieConfig,
};
String
. The customer user idAuthType
. Type of authentication, AUTH
or REGISTRATION
TVAuthMode
. The source of authentication process, it might be Nfc
or Selfie
TVSelfieConfiguration
. The configuration of selfie capturingboolean
. Enable call API face authentication or notboolean
. Enable call API face registration or notawait RNTrustVisionRnsdkFramework.startFaceAuthentication(config);
result:
cardType: CardType
. Card type
actionMode: TVConst.ActionMode
. Action Mode
selfieImages: [SelfieImage]
. List of selfie image objects
livenessVideos: [Base64 String]
. List of liveness videos data base64
livenessMetadata: json
livenessVideoFramesList: [json]
idFrontImage: ImageClass
. Id front image object
idBackImage: ImageClass
. Id back image object
frontIdQr: TVCardQr
. Front Id card's QR info
backIdQr: TVCardQr
. Back Id card's QR info
frontIdCapturingVideoFramesList: json
backIdCapturingVideoFramesList: json
nfcInfoResult: TVNfcInfoResult
. NFC info result
faceAuthRegisterResult: TVFaceAuthRegisterResult
faceAuthResult: TVFaceAuthResult
SelfieImage:
String
. UP | DOWN | LEFT | RIGHT | FRONTAL
ImageClass
. Frontal image objectImageClass
. Gesture image objectImageClass:
String
. Base64 string of image dataString
. Image labeljson
. Image metadataTVCardQr:
Bool
. This side of card contains QR or not[ImageClass]
. QR imagesError:
String
. The specific error codeString
. The human-readable error description can be show to end userTVNfcInfoResult:
String
String
String
String
String
String
String
TVNfcVerificationResult
TVNfcVerificationResult:
TVNfcVerificationResultStatus
TVNfcVerificationResultStatus:
TVError
TVNfcVerdict
. TVNfcVerdict.notChecked | TVNfcVerdict.alert | TVNfcVerdict.good | TVNfcVerdict.error
TVFaceAuthRegisterResult:
String
String
. success | failure
TVFaceAuthResult:
String
String
. success | failure
Float
MatchResult
. MatchResult.match | MatchResult.unmatched | MatchResult.unsure
This document introduces how to enable the ability to customize UI components of TrustingVision SDK.
Check out the default UI of TrustingVision SDK. We provide you the ability to change and modify many UI components: background colors, font interfaces, font sizes, icons, buttons.
Initialize and change properties of TVTheme
class. If any of which is not set, it will get default value.
After that, input the instance of TVTheme
as a parameter of the TV SDK's initialization method. See Initialize TV SDK
TVTheme
let you custom and override attributes, which includes:
Properties/Functions | Type | Description |
---|---|---|
idCapturingTheme | TVIdCapturingTheme | Attributes that change the UI of ID Card Detection screen. |
idConfirmationTheme | TVIdConfirmationTheme | Attributes that change the UI of ID Confirmation screen. |
selfieCapturingTheme | TVSelfieCapturingTheme | Attributes that change the UI of Selfie Capturing screen. |
selfieConfirmationTheme | TVSelfieConfirmationTheme | Attributes that change the UI of Selfie Confirmation screen. |
qrGuidelinePopupTheme | TVQrPopupTheme | Modifying UI of QR guideline popup. |
qrRetryPopupTheme | TVQrPopupTheme | Modifying UI of QR retry popup. |
Object TVThemeDefaultValues
helps you to quickly change some common UI components that will be used across the whole SDK.
In case a specific Screen's theme is set, it will override TVThemeDefaultValues
's properties.
Properties | Type | Description |
---|---|---|
normalLabelTheme | TVLabelTheme | Normal text of SDK. |
titleLabelTheme | TVLabelTheme | The title of every screen (located on the top-most, centered of screen). |
errorLabelTheme | TVLabelTheme | This text is shown as if any user misconduction or system failure occurred during the detection process. |
instructionLabelTheme | TVLabelTheme | Instruction text. |
timeoutLabelTheme | TVLabelTheme | The count down text. |
The object TVLabelTheme
can be described in this table below:
Properties/Functions | Type | Label's |
---|---|---|
fontStyle | String | font style, valid values: "REGULAR" , "BOLD" , "BOLD_ITALIC" , "ITALIC" |
textSize | Float | text size |
textColor | String (hex color e.g "#FFFFFF") | text color |
textGravity | String | text alignment of its frame. Valid values: "CENTER" , "LEFT" , "RIGHT" |
backgroundColors | [String] (array of hex colors e.g ["#00FFFFFF", "#000000"]) | background colors. If total elements of this array is >= 2, the background color is gradient, else it'd be solid. |
isBackgroundGradientHorizontal | Boolean | background gradient direction |
cornerRadius | Float | rounded corner |
isHidden | Boolean | whether or not should hide the label |
borderWidth | Float | border width |
borderColor | String (hex color e.g "#00FFFFFF") | border color |
Class TVIdCapturingTheme
If a property is not set then the default value will be used.
Properties/Functions | Type | Description |
---|---|---|
titleLabelTheme | TVLabelTheme | See Common UI components section. |
instructionLabelTheme | TVLabelTheme | |
errorLabelTheme | TVLabelTheme | |
timeoutLabelTheme | TVLabelTheme | |
normalLabelTheme | TVLabelTheme | |
qrInstructionLabelTheme | TVLabelTheme | The instruction text that show during QR scanning process. |
closeButtonLocation | String | The position of close button to device orientation:TOP_LEFT : to the left of the title TOP_RIGHT : to the right of the title NONE : hide the button |
showTrademark | Boolean | Show the trademark text or not. |
backgroundColor | String (hex color e.g "#FFFFFF") | Background color of the screen. Default value is black with 60% opacity. |
captureButtonImage | String (Base64 encoding) | The image of the capture button. |
captureButtonDisableImage | String (Base64 encoding) | The image of the disabled capture button. |
closeButtonImage | String (Base64 encoding) | The image of the close view button. |
maskViewNeutralImage | String (Base64 encoding) | The mask image of camera view when start the ID Capture flow. |
maskViewSuccessImage | String (Base64 encoding) | The mask image of camera view when detected a valid ID card. |
maskViewErrorImage | String (Base64 encoding) | The mask image of camera view when cannot detect any ID card. |
qrInstructionBackgroundImage | String (Base64 encoding) | The image behind the QR instruction text. |
qrMaskViewNeutralImage | String (Base64 encoding) | The mask image of camera view when start QR detection or not detected any QR code. |
qrMaskViewSuccessImage | String (Base64 encoding) | The mask image of camera view when detected a valid QR code. |
qrMaskViewErrorImage | String (Base64 encoding) | The mask image of camera view when detected an invalid QR code. |
loadingImage | String (Base64 encoding) | Loading indicator in image. |
Class TVIdConfirmationTheme
If a property is not set then the default value will be used.
Properties/Functions | Type | Description |
---|---|---|
titleLabelTheme | TVLabelTheme | See Common UI components section. |
errorLabelTheme | TVLabelTheme | |
normalLabelTheme | TVLabelTheme | |
closeButtonLocation | String | The position of close button to device orientation: TOP_LEFT : to the left of the title TOP_RIGHT : to the right of the title NONE : hide the button |
showTrademark | Boolean | Show the trademark text or not. |
backgroundColor | String (hex color e.g "#FFFFFF") | Background color of the screen. Default value is black with 60% opacity. . |
closeButtonImage | String (Base64 encoding) | The image of the close view button. |
confirmButtonImage | String (Base64 encoding) | The image of the "Look good" button. |
retryButtonImage | String (Base64 encoding) | The image of the "Try again" button. |
icQrResultSuccessImage | String (Base64 encoding) | Icon before text that scanned QR successfully. |
icQrResultErrorImage | String (Base64 encoding) | Icon before text that scanned QR failed. |
maskViewImage | String (Base64 encoding) | The mask image of camera view showing captured image. |
loadingImage | String (Base64 encoding) | Loading indicator in image. |
Class TVSelfieCapturingTheme
If a property is not set then the default value will be used.
Properties/Functions | Type | Description |
---|---|---|
titleLabelTheme | TVLabelTheme | See Common UI components section. |
instructionLabelTheme | TVLabelTheme | |
errorLabelTheme | TVLabelTheme | |
timeoutLabelTheme | TVLabelTheme | |
normalLabelTheme | TVLabelTheme | |
closeButtonLocation | String | The position of close button to device orientation: TOP_LEFT : to the left of the title TOP_RIGHT : to the right of the title NONE : hide the button |
showTrademark | Boolean | Show the trademark text or not. |
backgroundColor | String (hex color e.g "#FFFFFF") | Background color of the screen. Default value is black with 60% opacity. |
captureButtonImage | String (Base64 encoding) | The image of the capture button. |
captureButtonDisableImage | String (Base64 encoding) | The image of the disabled capture button. |
closeButtonImage | String (Base64 encoding) | The image of the close view button. |
switchCameraSideImage | String (Base64 encoding) | The image of switch camera button. |
maskViewNeutralImage | String (Base64 encoding) | The mask image of camera view when start the selfie flow. |
maskViewSuccessImage | String (Base64 encoding) | The mask image of camera view when detected a valid face. |
maskViewErrorImage | String (Base64 encoding) | The mask image of camera view when cannot detect any valid face. |
progressTheme.isHidden | Boolean | Whether or not should hide the current 4 steps view. |
progressTheme.backgroundColor | String (hex color e.g "#00FFFFFF") | Background color of the circle progress theme. |
progressTheme.progressColor | String (hex color e.g "#00FFFFFF") | Background color of the progress steps. |
gestureTheme.isHidden | Boolean | Whether of not should hide selfie steps' group view. |
gestureTheme.turnLeftActiveImage | String (Base64 encoding) | Image for turn left step gesture when active. |
gestureTheme.turnRightActiveImage | String (Base64 encoding) | Image for turn right step gesture when active. |
gestureTheme.turnUpActiveImage | String (Base64 encoding) | Image for turn up step gesture when active. |
gestureTheme.turnDownActiveImage | String (Base64 encoding) | Image for turn down step gesture when active. |
gestureTheme.lookStraightActiveImage | String (Base64 encoding) | Image for look straight step gesture when active. |
gestureTheme.turnLeftInactiveImage | String (Base64 encoding) | Image for turn left step gesture when inactive. |
gestureTheme.turnRightInactiveImage | String (Base64 encoding) | Image for turn right step gesture when inactive. |
gestureTheme.turnUpInactiveImage | String (Base64 encoding) | Image for turn up step gesture when inactive. |
gestureTheme.turnDownInactiveImage | String (Base64 encoding) | Image for turn down step gesture when inactive. |
gestureTheme.lookStraightInactiveImage | String (Base64 encoding) | Image for look straight step gesture when inactive. |
gestureTheme.finishedGestureBackgroundImage | String (Base64 encoding) | Background for every step that completed. |
gestureTheme.currentStepFocusImage | String (Base64 encoding) | Image overlay for current step indicator. |
maskViewErrorImage | String (Base64 encoding) | The mask image of camera view when cannot detect any valid face. |
maskViewErrorImage | String (Base64 encoding) | The mask image of camera view when cannot detect any valid face. |
loadingImage | String (Base64 encoding) | Loading indicator in image. |
Class TVSelfieConfirmationTheme
If a property is not set then the default value will be used.
Properties/Functions | Type | Description |
---|---|---|
titleLabelTheme | TVLabelTheme | See Common UI components section. |
normalLabelTheme | TVLabelTheme | |
closeButtonLocation | String | The position of close button to device orientation: TOP_LEFT : to the left of the title TOP_RIGHT : to the right of the title NONE : hide the button |
showTrademark | Boolean | Show the trademark text or not. |
backgroundColor | String (hex color e.g "#00FFFFFF") | Background color of the screen. Default value is black with 60% opacity. |
closeButtonImage | String (Base64 encoding) | The image of the close view button. |
maskViewImage | String (Base64 encoding) | The mask image of selfie captured image. |
loadingImage | String (Base64 encoding) | Loading indicator in image. |
Class TVQrPopupTheme
If a property is not set then the default value will be used.
Properties/Functions | Type | Description |
---|---|---|
titleLabelTheme | TVLabelTheme | See Common UI components section. |
descriptionTheme | TVLabelTheme | Theme of description text. |
primaryButtonTheme | TVLabelTheme | Theme of the main button of popup. |
secondaryButtonTheme | TVLabelTheme | Theme of sub-button of popup. |
timeoutLabelTheme | TVLabelTheme | Theme of timeout-warning text. |
backgroundColor | String (hex color e.g "#FFFFFF") | Background color of the view. |
const customizedTVTheme = () => {
const normalTextSize = 14.0;
const labelBackgroundColors = ["#00ffffff"]; // transparent. Set multiple colors if you want gradient
const normalLabelTextColor = "#ffffff"; // white
const errorLabelTextColor = "#ff0000"; //red
const labelBorderColor = "#00ffffff"; // transparent
const screenBackgroundColor = "#0D0D51"; // blue
const labelBorderWidth = 1.0;
const labelPaddingHorizontal = 10.0;
const labelPaddingVertical = 5.0;
const cornerRadius = 0.0;
const normalLabelTheme = {
isHidden: false,
textSize: normalTextSize,
fontStyle: TVThemeCustomization.FontStyle.REGULAR,
textColor: normalLabelTextColor,
backgroundColors: labelBackgroundColors,
isBackgroundGradientHorizontal: false,
cornerRadius: cornerRadius,
borderWidth: labelBorderWidth,
borderColor: labelBorderColor, // transparent
paddingHorizontal: labelPaddingHorizontal,
paddingVertical: labelPaddingVertical,
textGravity: TVThemeCustomization.TextGravity.CENTER,
};
const titleLabelTheme = {};
Object.assign(titleLabelTheme, normalLabelTheme);
titleLabelTheme["textSize"] = 16.0;
titleLabelTheme["fontStyle"] = TVThemeCustomization.FontStyle.BOLD;
const errorLabelTheme = {};
Object.assign(errorLabelTheme, normalLabelTheme);
errorLabelTheme["textSize"] = 12.0;
errorLabelTheme["textColor"] = errorLabelTextColor;
const timeoutLabelTheme = {};
Object.assign(timeoutLabelTheme, errorLabelTheme);
timeoutLabelTheme["isHidden"] = true;
const idCapturingTheme = {
titleLabelTheme: titleLabelTheme,
instructionLabelTheme: normalLabelTheme,
errorLabelTheme: errorLabelTheme,
timeoutLabelTheme: timeoutLabelTheme,
normalLabelTheme: normalLabelTheme,
closeButtonLocation: TVThemeCustomization.ButtonLocation.TOP_LEFT,
backgroundColor: "#80000000", // 50% black
captureButtonImage: "your_base64_image",
captureButtonDisableImage: "your_base64_image",
closeButtonImage: "your_base64_image",
maskViewNeutralImage: "your_base64_image",
maskViewSuccessImage: "your_base64_image",
maskViewErrorImage: "your_base64_image",
loadingImage: "your_base64_image",
qrInstructionLabelTheme: normalLabelTheme,
qrInstructionBackgroundImage: "your_base64_image",
qrMaskViewNeutralImage: "your_base64_image",
qrMaskViewSuccessImage: "your_base64_image",
qrMaskViewErrorImage: "your_base64_image",
};
const idConfirmationTheme = {
titleLabelTheme: titleLabelTheme,
errorLabelTheme: errorLabelTheme,
normalLabelTheme: normalLabelTheme,
closeButtonLocation: TVThemeCustomization.ButtonLocation.TOP_LEFT,
backgroundColor: screenBackgroundColor,
closeButtonImage: "your_base64_image",
icQrResultSuccessImage: "your_base64_image",
icQrResultErrorImage: "your_base64_image",
confirmButtonImage: "your_base64_image",
retryButtonImage: "your_base64_image",
maskViewImage: "your_base64_image",
loadingImage: "your_base64_image",
};
const gestureTheme = {
currentStepFocusImage: "your_base64_image",
turnLeftActiveImage: "your_base64_image",
finishedGestureBackgroundImage: "your_base64_image",
turnRightActiveImage: "your_base64_image",
turnUpActiveImage: "your_base64_image",
turnDownActiveImage: "your_base64_image",
lookStraightActiveImage: "your_base64_image",
turnLeftInactiveImage: "your_base64_image",
turnRightInactiveImage: "your_base64_image",
turnUpInactiveImage: "your_base64_image",
turnDownInactiveImage: "your_base64_image",
lookStraightInactiveImage: "your_base64_image",
};
const selfieCapturingTheme = {
titleLabelTheme: titleLabelTheme,
instructionLabelTheme: normalLabelTheme,
errorLabelTheme: errorLabelTheme,
timeoutLabelTheme: timeoutLabelTheme,
normalLabelTheme: normalLabelTheme,
closeButtonLocation: TVThemeCustomization.ButtonLocation.TOP_LEFT,
gestureTheme: gestureTheme,
backgroundColor: screenBackgroundColor,
captureButtonImage: "your_base64_image",
captureButtonDisableImage: "your_base64_image",
closeButtonImage: "your_base64_image",
maskViewNeutralImage: "your_base64_image",
maskViewSuccessImage: "your_base64_image",
maskViewErrorImage: "your_base64_image",
loadingImage: "your_base64_image",
switchCameraSideImage: "your_base64_image",
};
const selfieConfirmationTheme = {
titleLabelTheme: titleLabelTheme,
instructionLabelTheme: normalLabelTheme,
errorLabelTheme: errorLabelTheme,
normalLabelTheme: normalLabelTheme,
closeButtonLocation: TVThemeCustomization.ButtonLocation.TOP_LEFT,
backgroundColor: screenBackgroundColor,
closeButtonImage: "your_base64_image",
confirmButtonImage: "your_base64_image",
retryButtonImage: "your_base64_image",
maskViewImage: "your_base64_image",
loadingImage: "your_base64_image",
};
const qrPopupLabelTheme = {
textSize: 16.0,
textColor: "#99002F75" /* 60% opacity */,
};
const qrPopupPrimaryButtonTheme = {
cornerRadius: 3.0,
textSize: 16.0,
textColor: "#ffffff",
backgroundColors: ["#0276F1"], // set multiple color if you want gradients
};
const qrGuidelinePopupTheme = {
backgroundColor: "#ffffff",
headerImage: "your_base64_image",
titleLabelTheme: { isHidden: true }, // hide label,
descriptionTheme: qrPopupLabelTheme,
primaryButtonTheme: qrPopupPrimaryButtonTheme,
secondaryButtonTheme: { isHidden: true }, // hide button
timeoutLabelTheme: qrPopupLabelTheme,
};
const qrRetryPopupTheme = {
backgroundColor: "#ffffff",
headerImage: "your_base64_image",
titleLabelTheme: qrPopupLabelTheme,
descriptionTheme: qrPopupLabelTheme,
primaryButtonTheme: qrPopupLabelTheme,
secondaryButtonTheme: qrPopupLabelTheme,
timeoutLabelTheme: { isHidden: true }, // hide label
};
const tvTheme = {
idCapturingTheme: idCapturingTheme,
idConfirmationTheme: idConfirmationTheme,
selfieCapturingTheme: selfieCapturingTheme,
selfieConfirmationTheme: selfieConfirmationTheme,
qrGuidelinePopupTheme: qrGuidelinePopupTheme,
qrRetryPopupTheme: qrRetryPopupTheme,
};
return tvTheme;
};