UNPKG

react-native-scanbot-sdk

Version:

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

81 lines (75 loc) 3 kB
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import type { ColorValue, HostComponent, ViewProps } from 'react-native'; import type { DirectEventHandler, Double, Float, Int32, WithDefault, } from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; type Event = Readonly<{ result: string; }>; interface NativeProps extends ViewProps { onBarcodeScannerResult?: DirectEventHandler<Event>; onSelectBarcodeResult: DirectEventHandler<Event>; flashEnabled?: WithDefault<boolean, false>; finderEnabled?: WithDefault<boolean, false>; finderStrokeWidth?: WithDefault<Int32, 2>; finderStrokeColor?: ColorValue; finderOverlayColor?: ColorValue; finderMinPadding?: WithDefault<Int32, 0>; finderInset?: { left?: WithDefault<Int32, 10>; top?: WithDefault<Int32, 10>; bottom?: WithDefault<Int32, 10>; right?: WithDefault<Int32, 10>; }; finderRequiredAspectRatios?: { width?: WithDefault<Double, 4>; height?: WithDefault<Double, 3>; }; cameraZoomFactor?: WithDefault<Float, 0.0>; cameraZoomRange?: { minZoom?: WithDefault<Float, 1.0>; maxZoom?: WithDefault<Float, 12.0>; }; cameraModule?: WithDefault<string, 'BACK'>; scanningEnabled?: WithDefault<boolean, true>; detectorConfig?: { barcodeFormats?: ReadonlyArray<string>; acceptedDocumentFormats?: ReadonlyArray<string>; engineMode?: WithDefault<string, 'NEXT_GEN'>; barcodesExtensionFilter?: WithDefault<string, 'NO_FILTER'>; lowPowerMode?: WithDefault<boolean, false>; minimumTextLength?: WithDefault<Int32, 0>; maximumTextLength?: WithDefault<Int32, 0>; minimum1DBarcodesQuietZone?: WithDefault<Int32, 10>; stripCheckDigits?: WithDefault<boolean, false>; gs1HandlingMode?: WithDefault<string, 'PARSE'>; msiPlesseyChecksumAlgorithm?: WithDefault<string, 'MOD_10'>; }; minFocusDistanceLock?: WithDefault<boolean, false>; overlayEnabled?: WithDefault<boolean, false>; overlayPolygonColor?: ColorValue; overlayStrokeColor?: ColorValue; overlayTextColor?: ColorValue; overlayTextContainerColor?: ColorValue; overlayTextFormat?: WithDefault<string, 'CODE_AND_TYPE'>; overlayLoadingTextValue?: WithDefault<string, undefined>; overlayBarcodeItemOverlayViewBinder?: WithDefault<boolean, false>; } export default codegenNativeComponent<NativeProps>('ScanbotBarcodeScannerView'); interface NativeCommands { freezeCamera: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void; unfreezeCamera: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void; bindBarcodeItemOverlayView: ( viewRef: React.ElementRef<HostComponent<NativeProps>>, barcodeItemUuid: string, bindingConfig: string ) => void; } export const Commands = codegenNativeCommands<NativeCommands>({ supportedCommands: ['freezeCamera', 'unfreezeCamera', 'bindBarcodeItemOverlayView'], });