Barcode Capture AIO View
Defined under the namespace Scandit.Datacapture.Barcode.Ui
- BarcodeCaptureAioView
class BarcodeCaptureAioViewAdded in version 8.7.0
An all-in-one React component for Barcode Capture. Rendering this single element replaces the manual assembly of a DataCaptureContext, a BarcodeCapture mode, a DataCaptureView and a BarcodeCaptureOverlay — the component owns all of them, along with its camera claim and its lifecycle.
The component must be rendered inside a ScanditProvider, which supplies the DataCaptureContext and the shared camera. Scanning starts once the component is mounted and enabled, and stops when it unmounts.
Configuration is passed through BarcodeCaptureAioViewProps. To gain manual control over the component, attach a React
reftyped as BarcodeCaptureAioViewHandle.To build your first screen with the AIO components, refer to the AIO components getting started guide. For the classic API, refer to the Barcode Capture Get Started guide.
- BarcodeCaptureAioViewProps
interface BarcodeCaptureAioViewPropsAdded in version 8.7.0
Configuration for BarcodeCaptureAioView.
A settings source is required: pass either symbologies or barcodeCaptureSettings. Both are optional on this interface, but BarcodeCaptureAioView requires one of them, so rendering the component with neither is a compile error. Supplying both is allowed, and barcodeCaptureSettings takes precedence. Every other prop is optional; the basic overlay is attached by default.
- didScan(barcodes, session, getFrameData)
didScan?(barcodes: Barcode[], session: BarcodeCaptureSession, getFrameData: () => Promise<FrameData>):
void| Promise<void>Added in version 8.7.0
Called for each newly-recognized barcode.
Return a promise to keep the frame alive while asynchronous work runs.
getFrameData()resolves to the FrameData for the frame, and becomes invalid once the returned promise resolves. Synchronous handlers do not affect throughput.Backed by the native BarcodeCaptureListener.didScan() event, so it fires only on a recognition, independently of didUpdateSession().
- didUpdateSession(session, getFrameData)
didUpdateSession?(session: BarcodeCaptureSession, getFrameData: () => Promise<FrameData>):
void| Promise<void>Added in version 8.7.0
Called on every session update — roughly once per processed frame — regardless of whether a barcode was recognized. Backed by the native BarcodeCaptureListener.didUpdateSession() event and independent of didScan().
An
asynchandler is awaited by the native pipeline, which keepsgetFrameData()valid through the asynchronous work but can slow frame processing. Handlers that do not need frame data should stay synchronous.
- symbologies
symbologies?: Symbology[]
Added in version 8.7.0
Symbologies to enable. Shorthand for BarcodeCaptureSettings.enabledSymbologies; ignored when barcodeCaptureSettings is set.
- locationSelection
locationSelection?: LocationSelection |
nullAdded in version 8.7.0
Restricts the scan area within the camera frame. Shorthand for BarcodeCaptureSettings.locationSelection; ignored when barcodeCaptureSettings is set.
- compositeTypes
compositeTypes?: CompositeType[]
Added in version 8.7.0
Composite barcode types to enable, such as GS1 composites. Shorthand for BarcodeCaptureSettings.enabledCompositeTypes; ignored when barcodeCaptureSettings is set.
- batterySaving
batterySaving?: BatterySavingMode
Added in version 8.7.0
Battery saving mode. Shorthand for BarcodeCaptureSettings.batterySaving; ignored when barcodeCaptureSettings is set.
- scanIntention
scanIntention?: ScanIntention
Added in version 8.7.0
Whether scanning is smart or manual. Shorthand for BarcodeCaptureSettings.scanIntention; ignored when barcodeCaptureSettings is set.
- codeDuplicateFilter
codeDuplicateFilter?: number
Added in version 8.7.0
Time interval in milliseconds during which duplicate barcodes are filtered out. Shorthand for BarcodeCaptureSettings.codeDuplicateFilter; ignored when barcodeCaptureSettings is set.
- arucoDictionary
arucoDictionary?: ArucoDictionary
Added in version 8.7.0
The ArUco marker dictionary to use. Shorthand for the equivalent setting on BarcodeCaptureSettings; ignored when barcodeCaptureSettings is set.
- barcodeCaptureSettings
barcodeCaptureSettings?: BarcodeCaptureSettings |
nullAdded in version 8.7.0
The settings applied to the underlying mode, as a complete BarcodeCaptureSettings object. Takes precedence over the shorthand settings props above; when both are given, the shorthand props are ignored.
- basicOverlay
basicOverlay?: BarcodeCaptureAioBasicOverlayProps
Added in version 8.7.0
Configuration for the basic overlay, described by BarcodeCaptureAioBasicOverlayProps, which draws a brush over recognized barcodes and can render a viewfinder. The overlay is attached by default, so omitting this prop yields the default overlay; pass
{ enabled: false }to skip it entirely.
- feedback
feedback?: BarcodeCaptureFeedback
Added in version 8.7.0
Sound and vibration feedback emitted on scan, as a BarcodeCaptureFeedback. Omit to use the SDK default, which enables both sound (a beep) and vibration.
- torchSwitchControl
torchSwitchControl?: TorchSwitchControl |
nullAdded in version 8.7.0
A torch toggle rendered on the view.
- zoomSwitchControl
zoomSwitchControl?: ZoomSwitchControl |
nullAdded in version 8.7.0
A zoom toggle rendered on the view.
navigation?: ScanditNavigationProp
Added in version 8.7.0
Navigation object for the screen the component is rendered on, for example React Navigation’s
navigationprop (typed as ScanditNavigationProp). When it is provided, scanning is suspended — the mode is disabled and the camera turned off — while the screen is blurred or the application is backgrounded, and resumed when the screen regains focus. Ignored while disabled is set.
- disabled
disabled?: boolean
Added in version 8.7.0
Set to true to keep scanning off. Leaving it false does not keep scanning on — navigation and app-state handling still turn the mode on and off on their own.
BarcodeCaptureAioViewHandle.enable() and BarcodeCaptureAioViewHandle.disable() change the same state directly. If you call those, this prop no longer reflects whether the component is actually scanning.
- appStateHandlingDisabled
appStateHandlingDisabled?: boolean
Added in version 8.7.0
Turns off the automatic enabling and disabling of the mode in response to the application moving between foreground and background.
- style
style?: StyleProp<ViewStyle>
Added in version 8.7.0
Style applied to the view, defaulting to
{ flex: 1 }. This is the only React NativeViewprop the component forwards — it renders its own DataCaptureView and passes nothing else through.
- BarcodeCaptureAioBasicOverlayProps
interface BarcodeCaptureAioBasicOverlayPropsAdded in version 8.7.0
Configuration for the BarcodeCaptureOverlay that BarcodeCaptureAioView attaches by default, passed through BarcodeCaptureAioViewProps.basicOverlay. Every member is optional.
- enabled
enabled?: boolean
Added in version 8.7.0
Whether to attach the basic overlay at all. Defaults to true; pass false to render the camera preview without it.
- defaultBrush
defaultBrush?: Brush |
nullAdded in version 8.7.0
Default brush applied to every recognized barcode. To turn off drawing of locations, use a brush with both a transparent fill and a transparent stroke color. Defaults to a brush with a transparent fill color, a “Scandit”-blue stroke color and a stroke width of 1.
- viewfinder
viewfinder?: Viewfinder |
nullAdded in version 8.7.0
The viewfinder drawn by the basic overlay. Defaults to null, in which case no viewfinder is drawn.
- BarcodeCaptureAioViewHandle
interface BarcodeCaptureAioViewHandleAdded in version 8.7.0
Imperative operations on a BarcodeCaptureAioView, reached through a
refon the component.- reset()
reset(): Promise<
void>Added in version 8.7.0
Resets the barcode capture session, clearing the history of scanned codes. This affects duplicate filtering: calling reset() every frame has the same effect as setting BarcodeCaptureSettings.codeDuplicateFilter to 0. Only call it from inside a listener callback.
- viewPointForFramePoint(point)
viewPointForFramePoint(point: Point): Promise<Point>
Added in version 8.7.0
Converts a point in the coordinate system of the last visible frame to a coordinate in the view. Thread-safe.
- viewQuadrilateralForFrameQuadrilateral(quadrilateral)
viewQuadrilateralForFrameQuadrilateral(quadrilateral: Quadrilateral): Promise<Quadrilateral>
Added in version 8.7.0
Converts a quadrilateral in the coordinate system of the last visible frame to coordinates in the view.
- addControl(control)
addControl(control: Control): Promise<
void>Added in version 8.7.0
Adds a control to the view. When several controls are added, the order of the addControl() calls determines their layout. Has no effect if the control is already part of the view.
- removeControl(control)
removeControl(control: Control):
voidAdded in version 8.7.0
Removes a control previously added with addControl().
- addAdaptiveRecognitionServiceListener(listener)
addAdaptiveRecognitionServiceListener(listener: AdaptiveRecognitionServiceListener):
voidAdded in version 8.7.0
Adds the listener to the barcode capture mode that this component owns. See BarcodeCapture.addAdaptiveRecognitionServiceListener().
- removeAdaptiveRecognitionServiceListener(listener)
removeAdaptiveRecognitionServiceListener(listener: AdaptiveRecognitionServiceListener):
voidAdded in version 8.7.0
Removes a listener previously added with addAdaptiveRecognitionServiceListener().