react-native-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS
126 lines • 6.97 kB
TypeScript
import { ColorValue, ViewStyle } from 'react-native';
import { BarcodeScannerResult } from '../../results';
import { AspectRatio, BarcodeDocumentFormat, BarcodeFormat, BarcodeOverlayTextFormat, BarcodeResultField, BarcodesExtensionFilter, CameraModule, EngineMode, Gs1HandlingMode, MSIPlesseyChecksumAlgorithm, ZoomRange } from '../../types';
import { StyleProp } from 'react-native/Libraries/StyleSheet/StyleSheet';
import React from 'react';
export interface ScanbotBarcodeCameraViewProperties {
/** Configuration properties of the finder overlay */
finderConfig?: FinderConfig;
/** Configuration properties of the camera device */
cameraConfig?: CameraConfig;
/** An interface that defines parameters for barcodes detection and filtering */
detectorConfig?: DetectorConfig;
/** The selection overlay configuration. */
selectionOverlayConfig?: SelectionOverlayConfig;
/** Whether flash is toggled on or off. */
flashEnabled?: boolean;
/**
* Enable or disable barcode detection.
* If disabled, the camera preview is active but no barcodes will be detected.
* Default is enabled.
*/
scanningEnabled?: boolean;
onBarcodeScannerResult: (result: BarcodeScannerResult) => void;
style?: StyleProp<ViewStyle>;
contentContainerStyle?: StyleProp<ViewStyle>;
children?: React.ReactNode;
}
/** Configuration properties of the finder overlay */
export interface FinderConfig {
/** Display the region of interest. The default value is TRUE. */
viewFinderEnabled?: boolean;
/** Width of finder frame border. */
finderLineWidth?: number;
/** Color of finder frame border. */
finderLineColor?: string;
/** Background color of the detection overlay. */
overlayColor?: string;
/** The minimum space from view finders outer edges to the view edges. */
finderInset?: FinderInset;
/** Initial padding for insets. Android only. */
minPadding?: number;
/** Aspect ratio of finder frame (width \ height), which is used to build actual finder frame. */
requiredAspectRatio?: AspectRatio;
}
/** Configuration properties of the camera device */
export interface CameraConfig {
/** The relative initial zoom level of the camera in the range (0,1), where 0 is zoomed out and 1 is zoomed in. Default value is 0.0. */
cameraZoomFactor?: number;
/** The range of valid camera zoom factors. Default value is (1.0; 12.0). */
cameraZoomRange?: ZoomRange;
/** The camera module to be used for barcode scanning */
cameraModule?: CameraModule;
/** Lock focus distance withing minimum possible range */
minFocusDistanceLock?: boolean;
}
/** An interface that defines parameters for barcodes detection and filtering */
export interface DetectorConfig {
/** Accepted barcode formats */
barcodeFormats?: BarcodeFormat[];
/** An optional array of barcode document formats that act as a detection filter. By default all supported document formats will be detected. */
acceptedDocumentFormats?: BarcodeDocumentFormat[];
/** The engine mode to be used for barcode scanning. The default value is NEXT_GEN. */
engineMode?: EngineMode;
/** The extension filter for EAN and UPC barcodes. */
barcodesExtensionFilter?: BarcodesExtensionFilter;
/** If `true`, enabled the mode which slightly decreases the scanning quality and the energy consumption, and increases the scanning speed. If `false` - mode is disabled. The default is `false` */
lowPowerMode?: boolean;
/** Optional minimum required text length of the detected barcode. The default is 0 (setting is turned off). NOTE - This feature works on ITF barcodes only. */
minimumTextLength?: number;
/** Optional maximum text length of the detected barcode. The default is 0 (setting is turned off). NOTE - This feature works on ITF barcodes only. */
maximumTextLength?: number;
/** Optional minimum required quiet zone on the barcode. Measured in modules (the size of minimal bar on the barcode). The default is 10. NOTE - This feature works on ITF barcodes only. */
minimum1DBarcodesQuietZone?: number;
/** With this option enabled, the scanner removes checks digits for UPC, EAN and MSI Plessey codes. Has no effect if both single and double digit MSI Plessey checksums are enabled. The default is `false` */
stripCheckDigits?: boolean;
/** The GS1 handling mode. The default value is PARSE. */
gs1HandlingMode?: Gs1HandlingMode;
/** The checksum algorithm for MSI Plessey barcodes. The default value is MOD_10. */
msiPlesseyChecksumAlgorithm?: MSIPlesseyChecksumAlgorithm;
}
/** The selection overlay configuration. */
export interface SelectionOverlayConfig {
/** Whether the barcode selection overlay is enabled or not. */
overlayEnabled?: boolean;
/** Define the way of how to show barcode data with selection overlay. */
textFormat?: BarcodeOverlayTextFormat;
/** The color of the polygon in the selection overlay. */
polygonColor?: ColorValue;
/** The color of the text in the selection overlay. */
textColor?: ColorValue;
/** The color of the texts background in the selection overlay. */
textContainerColor?: ColorValue;
/** The color of the polygon border. */
strokeColor?: ColorValue;
/** Whether the barcode is highlighted automatically when being detected or not. */
automaticSelectionEnabled?: boolean;
/** Only used if the barcodeItemOverlayViewBinder callback is set. */
loadingTextValue?: string;
/** Callback that configures the selection overlay for each barcode item individually. */
barcodeItemOverlayViewBinder?: (barcodeItem: BarcodeResultField) => Promise<BarcodeItemOverlayViewConfig> | BarcodeItemOverlayViewConfig;
}
export interface FinderInset {
left: number;
top: number;
bottom: number;
right: number;
}
export interface ScanbotBarcodeCameraViewHandle {
/** Freezes the camera preview */
freezeCamera(): void;
/** Unfreezes the previously frozen camera preview */
unfreezeCamera(): void;
}
export interface BarcodeItemOverlayViewConfig {
/** Custom text in the selection overlay. If not set, the textFormat property from the SelectionOverlayConfig is taken into account. */
text: string;
/** The color of the text in the selection overlay. If not set, the textColor from SelectionOverlayConfig is used. */
textColor?: string;
/** The color of the texts background in the selection overlay. If not set, the textContainerColor from SelectionOverlayConfig is used. */
textContainerColor?: string;
/** The color of the polygon in the selection overlay. If not set, the polygonColor from SelectionOverlayConfig is used. */
polygonColor?: string;
/** The color of the polygon border. If not set, the strokeColor from SelectionOverlayConfig is used. */
strokeColor?: string;
}
//# sourceMappingURL=ScanbotBarcodeCameraViewProperties.d.ts.map