UNPKG

react-native-scanbot-sdk

Version:

Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS

181 lines (176 loc) 5.59 kB
import { AspectRatio, CameraModule, CameraPreviewMode, CapturePhotoQualityPrioritization, } from '../../types'; import { StyleProp } from 'react-native/Libraries/StyleSheet/StyleSheet'; import { ColorValue, ViewStyle } from 'react-native'; import { DocumentDetectionStatus } from '../../document/DocumentDetectionStatus'; export interface ScanbotDocumentScannerViewProperties { style?: StyleProp<ViewStyle>; /** Detected document image as base64 result */ onDocumentScannerResult: (result: string) => void; /** The detection status of the Document Scanner */ onDetectionResult?: (result: DocumentDetectionStatus) => void; /** The minimum score in percent (0 - 100) of the perspective distortion to accept a detected document. Default is 75.0 */ acceptedAngleScore?: number; /** The brightness threshold to accept a detected document in the range of 0 (very dark) to 255 (very bright). If the average brightness value of the detectors input image is below this value, the status of the detection will be set to ERROR_TOO_DARK. Default is 50.0 */ acceptedBrightnessThreshold?: number; /** The minimum document width or height in percent (0 - 100) of the screen size to accept a detected document. Default is 80.0 */ acceptedSizeScore?: number; /** When auto-snapping is enabled the document scanner will take a photo automatically when a document is detected, conditions are good and the auto-snapping time-out elapses. In this mode the user can still tap the shutter button to snap a document. Default is true */ autoSnappingEnabled?: boolean; /** Controls the auto-snapping speed. Sensitivity must be within the 0..1 range. A value of 1.0 triggers automatic capturing immediately, a value of 0.0 delays the automatic by 3 seconds. Default is 0.66 */ autoSnappingSensitivity?: number; /** The minimum delay in seconds between two consecutive automatic image captures. iOS only. Default is 1.0 */ autoSnappingDelay?: number; /** The preferred camera module. Default is BACK */ cameraModule?: CameraModule; /** Preview mode of the camera. Fit-In or Fill-In. Default is FILL_IN */ cameraPreviewMode?: CameraPreviewMode; /** Controls whether the flash should be initially enabled. Default is false */ flashEnabled?: boolean; /** Sets whether to ignore the OK_BUT_BAD_ASPECT_RATIO detection status. Default is false */ ignoreBadAspectRatio?: boolean; /** The prioritization of still image quality and capturing speed. If you experience lots of blurry still images try to set this property to CapturePhotoQualityPrioritization.QUALITY. Note: It has no effect on devices prior to iOS 13.0!. Default is BALANCED */ photoQualityPrioritization?: CapturePhotoQualityPrioritization; /** Whether touch-to-focus is enabled on camera preview. Android only. Default is true */ touchToFocusEnabled?: boolean; /** An optional array of aspect ratios the documents have to conform to. */ requiredAspectRatios?: AspectRatio[]; /** Whether the viewfinder is visible. Default is false */ finderEnabled?: boolean; /** Foreground color of the detection overlay. Default is "#FFFFFF" */ finderLineColor?: ColorValue; /** Width of finder frame border. Default is 2 */ finderLineWidth?: number; /** Background color outside of the finder window. Default is "#000000CC" */ finderOverlayColor?: ColorValue; /** Radius of the viewfinder's corners. iOS only. Default is 10.0 */ finderCornerRadius?: number; /** Determines the finder padding. Default is 20.0 */ finderMinimumPadding?: number; /** Aspect ratio of the finder frame (width to height), which is used to build the actual finder frame. */ finderAspectRatio?: AspectRatio; /** Whether to display the document's polygon. Default is true */ polygonEnabled?: boolean; /** The background color of the detected document outline when the document's angle, size or aspect ratio is not yet sufficiently good. Default is "#FFFFFF00" */ polygonBackgroundColor?: ColorValue; /** The background color of the detected document outline when we are ready to snap OK. Default is "#FFFFFF00" */ polygonBackgroundColorOK?: ColorValue; /** The color of the detected document outline when the document's angle, size or aspect ratio is not yet sufficiently good. Default is "#FF00004D" */ polygonColor?: ColorValue; /** The color of the detected document outline when we are ready to snap OK. Default is "#00CEA6" */ polygonColorOK?: ColorValue; /** Width of the detected document outline. Default is 3 */ polygonLineWidth?: number; /** The radius to use when drawing rounded corners of the polygon. Default is 8.0 */ polygonCornerRadius?: number; /** Stroke color of polygon auto snap progress animation. Default is "#87F2DE" */ polygonAutoSnapProgressColor?: ColorValue; /** Line width of polygon auto snap progress animation. Default is 5.0 */ polygonAutoSnapProgressLineWidth?: number; /** Whether polygon auto snap progress animation is enabled or not. Default is true */ polygonAutoSnapProgressEnabled?: boolean; } export interface ScanbotDocumentScannerViewHandle { /** Freezes the camera preview */ freezeCamera(): void; /** Unfreezes the previously frozen camera preview */ unfreezeCamera(): void; /** Snaps a document */ snapDocument(): void; }