import { ColorValue, HostComponent, ViewProps } from 'react-native'; import { DirectEventHandler, WithDefault, type Double, type Int32, } from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; export type onNativeDocumentScannerResult = Readonly<{ originalImage: string; documentImage?: string; detectionResult?: string; }>; export type onNativeDocumentDetectionResult = Readonly<{ result: string; }>; export type onNativeError = Readonly<{ message: string; code: Int32; }>; interface NativeProps extends ViewProps { onDocumentScannerResult?: DirectEventHandler; onDetectionResult?: DirectEventHandler; onError?: DirectEventHandler>; flashEnabled?: WithDefault; hardwareButtonsEnabled?: WithDefault; detectDocumentAfterSnap?: WithDefault; acceptedAngleScore?: WithDefault; acceptedSizeScore?: WithDefault; acceptedBrightnessThreshold?: WithDefault; acceptedAspectRatioScore?: WithDefault; requiredAspectRatios?: Array<{ width?: Double; height?: Double }>; ignoreOrientationMismatch?: WithDefault; partiallyVisibleDocumentConfiguration?: { allowPartiallyVisibleDocuments?: WithDefault; accumulationDuration?: WithDefault; retentionTime?: WithDefault; minimumBrightness?: WithDefault; }; autoSnappingEnabled?: WithDefault; autoSnappingSensitivity?: WithDefault; autoSnappingDelay?: WithDefault; cameraModule?: WithDefault; cameraPreviewMode?: WithDefault; photoQualityPrioritization?: WithDefault; touchToFocusEnabled?: WithDefault; finderEnabled?: WithDefault; finderLineColor?: ColorValue; finderLineWidth?: WithDefault; finderOverlayColor?: ColorValue; finderCornerRadius?: WithDefault; finderMinimumPadding?: WithDefault; finderAspectRatio?: { width?: WithDefault; height?: WithDefault; }; polygonEnabled?: WithDefault; polygonBackgroundColor?: ColorValue; polygonBackgroundColorOK?: ColorValue; polygonColor?: ColorValue; polygonColorOK?: ColorValue; polygonLineWidth?: WithDefault; polygonCornerRadius?: WithDefault; polygonAutoSnapProgressColor?: ColorValue; polygonAutoSnapProgressLineWidth?: WithDefault; polygonAutoSnapProgressEnabled?: WithDefault; } export default codegenNativeComponent('ScanbotDocumentScannerView'); interface NativeCommands { freezeCamera: (viewRef: React.ElementRef>) => void; unfreezeCamera: (viewRef: React.ElementRef>) => void; snapDocument: ( viewRef: React.ElementRef>, acquireFocus: boolean ) => void; } export const Commands = codegenNativeCommands({ supportedCommands: ['freezeCamera', 'unfreezeCamera', 'snapDocument'], });