react-native-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS
37 lines (31 loc) • 1.39 kB
text/typescript
import { ColorValue, ViewProps, type HostComponent } from 'react-native';
import {
Double,
WithDefault,
type DirectEventHandler,
} 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<CroppingViewEvent>;
onError?: DirectEventHandler<CroppingViewEvent>;
imageFileSrc?: string;
imageRefSrc?: string;
edgeColor?: ColorValue;
edgeLineWidth?: WithDefault<Double, 2.0>;
edgeColorOnLine?: ColorValue;
anchorPointsColor?: ColorValue;
}
export default codegenNativeComponent<NativeProps>('ScanbotCroppingView');
interface NativeCommands {
resetPolygon: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
detectPolygon: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
rotate: (viewRef: React.ElementRef<HostComponent<NativeProps>>, clockwise: boolean) => void;
extractCroppedArea: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
}
export const Commands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['resetPolygon', 'detectPolygon', 'rotate', 'extractCroppedArea'],
});