UNPKG

react-native-scanbot-sdk

Version:

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

66 lines (60 loc) 2.66 kB
import { type ColorValue, type HostComponent, ViewProps } from 'react-native'; import { DirectEventHandler, type Double, WithDefault, } from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; export type DocumentScannerEvent = Readonly<{ result: string; }>; interface NativeProps extends ViewProps { onDocumentScannerResult?: DirectEventHandler<DocumentScannerEvent>; onDetectionResult?: DirectEventHandler<DocumentScannerEvent>; acceptedAngleScore?: WithDefault<Double, 75.0>; acceptedBrightnessThreshold?: WithDefault<Double, 50.0>; acceptedSizeScore?: WithDefault<Double, 80.0>; autoSnappingEnabled?: WithDefault<boolean, true>; autoSnappingSensitivity?: WithDefault<Double, 0.66>; autoSnappingDelay?: WithDefault<Double, 1.0>; cameraModule?: WithDefault<string, 'BACK'>; cameraPreviewMode?: WithDefault<string, 'FILL_IN'>; flashEnabled?: WithDefault<boolean, false>; ignoreBadAspectRatio?: WithDefault<boolean, false>; photoQualityPrioritization?: WithDefault<string, 'BALANCED'>; touchToFocusEnabled?: WithDefault<boolean, true>; requiredAspectRatios?: Array<{ width?: Double; height?: Double; }>; finderEnabled?: WithDefault<boolean, false>; finderLineColor?: ColorValue; finderLineWidth?: WithDefault<Double, 2.0>; finderOverlayColor?: ColorValue; finderCornerRadius?: WithDefault<Double, 10.0>; finderMinimumPadding?: WithDefault<Double, 20.0>; finderAspectRatio?: { width?: WithDefault<Double, 1.0>; height?: WithDefault<Double, 1.4142>; }; polygonEnabled?: WithDefault<boolean, true>; polygonBackgroundColor?: ColorValue; polygonBackgroundColorOK?: ColorValue; polygonColor?: ColorValue; polygonColorOK?: ColorValue; polygonLineWidth?: WithDefault<Double, 3.0>; polygonCornerRadius?: WithDefault<Double, 8.0>; polygonAutoSnapProgressColor?: ColorValue; polygonAutoSnapProgressLineWidth?: WithDefault<Double, 5.0>; polygonAutoSnapProgressEnabled?: WithDefault<boolean, true>; } export default codegenNativeComponent<NativeProps>('ScanbotDocumentScannerView'); interface NativeCommands { freezeCamera: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void; unfreezeCamera: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void; snapDocument: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void; } export const Commands = codegenNativeCommands<NativeCommands>({ supportedCommands: ['freezeCamera', 'unfreezeCamera', 'snapDocument'], });