import { ColorValue, ViewProps, type HostComponent } from 'react-native'; import { Double, WithDefault, type DirectEventHandler, 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 CroppingViewEvent = Readonly<{ result: string; }>; interface NativeProps extends ViewProps { onCroppedAreaResult: DirectEventHandler; onError: DirectEventHandler>; imageFileSrc?: string; imageRefSrc?: string; edgeColor?: ColorValue; edgeLineWidth?: WithDefault; edgeColorOnLine?: ColorValue; anchorPointsColor?: ColorValue; } export default codegenNativeComponent('ScanbotCroppingView'); interface NativeCommands { resetPolygon: (viewRef: React.ElementRef>) => void; detectPolygon: (viewRef: React.ElementRef>) => void; rotate: (viewRef: React.ElementRef>, clockwise: boolean) => void; extractCroppedArea: (viewRef: React.ElementRef>) => void; } export const Commands = codegenNativeCommands({ supportedCommands: ['resetPolygon', 'detectPolygon', 'rotate', 'extractCroppedArea'], });