Barcode Batch AIO View

Defined under the namespace Scandit.Datacapture.Barcode.Batch.Ui

BarcodeBatchAioView
class BarcodeBatchAioView

Added in version 8.7.0

An all-in-one React component for MatrixScan (Barcode Batch). Rendering this single element replaces the manual assembly of a DataCaptureContext, a BarcodeBatch mode, a DataCaptureView and its overlays — 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 BarcodeBatchAioViewProps. To gain manual control over the component, attach a React ref typed as BarcodeBatchAioViewHandle.

There is no feedback prop, because Barcode Batch has no feedback API at the SDK level. Feedback is triggered from BarcodeBatchAioViewProps.didScan().

To build your first screen with the AIO components, refer to the AIO components getting started guide. For the classic API, refer to the MatrixScan Get Started guide.

BarcodeBatchAioViewProps
interface BarcodeBatchAioViewProps

Added in version 8.7.0

Configuration for BarcodeBatchAioView.

A settings source is required: pass either symbologies or barcodeBatchSettings. Both are optional on this interface, but BarcodeBatchAioView requires one of them, so rendering the component with neither is a compile error. Supplying both is allowed, and barcodeBatchSettings takes precedence. Every other prop is optional; the basic overlay is attached by default.

didScan(barcodes, session, getFrameData)
didScan?(barcodes: TrackedBarcode[],
        session: BarcodeBatchSession,
        getFrameData: () => Promise<FrameData>): void | Promise<void>

Added in version 8.7.0

Called on each session update with every newly-added tracked barcode, taken from BarcodeBatchSession.addedTrackedBarcodes.

Derived from the same native BarcodeBatchListener.didUpdateSession() event as didUpdateSession(). When both are set, didUpdateSession completes first and then didScan fires, skipped when nothing was added. getFrameData() resolves to the FrameData for the frame and stays valid across both.

didUpdateSession(session, getFrameData)
didUpdateSession?(session: BarcodeBatchSession,
        getFrameData: () => Promise<FrameData>): void | Promise<void>

Added in version 8.7.0

Called on every session update, before didScan() for the same update. Backed by the native BarcodeBatchListener.didUpdateSession() event.

symbologies
symbologies?: Symbology[]

Added in version 8.7.0

Symbologies to enable. Shorthand for BarcodeBatchSettings.enabledSymbologies; ignored when barcodeBatchSettings is set.

barcodeBatchSettings
barcodeBatchSettings?: BarcodeBatchSettings | null

Added in version 8.7.0

The settings applied to the underlying mode, as a complete BarcodeBatchSettings object. Takes precedence over symbologies; when both are given, the shorthand is ignored and a warning is logged.

basicOverlay
basicOverlay?: BarcodeBatchAioBasicOverlayProps

Added in version 8.7.0

Configuration for the basic overlay, described by BarcodeBatchAioBasicOverlayProps, which draws a brush over each tracked barcode. The overlay is attached by default, so omitting this prop yields the default overlay; pass { enabled: false } to skip it entirely.

advancedOverlay
advancedOverlay?: BarcodeBatchAioAdvancedOverlayProps

Added in version 8.7.0

Configuration for the advanced overlay, which renders a custom view over each tracked barcode. Omit the prop entirely to skip the overlay; pass any object — even {} — to opt in. See BarcodeBatchAioAdvancedOverlayProps.

navigation
navigation?: ScanditNavigationProp

Added in version 8.7.0

Navigation object for the screen the component is rendered on, for example React Navigation’s navigation prop (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.

BarcodeBatchAioViewHandle.enable() and BarcodeBatchAioViewHandle.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 Native View prop the component forwards — it renders its own DataCaptureView and passes nothing else through.

BarcodeBatchAioBasicOverlayProps
interface BarcodeBatchAioBasicOverlayProps

Added in version 8.7.0

Configuration for the BarcodeBatchBasicOverlay that BarcodeBatchAioView attaches by default, passed through BarcodeBatchAioViewProps.basicOverlay. Every member is optional. The callback props correspond to the BarcodeBatchBasicOverlayListener methods, without the overlay argument.

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.

style
style?: BarcodeBatchBasicOverlayStyle | null

Added in version 8.7.0

The overlay style. Defaults to Frame.

defaultBrush
defaultBrush?: Brush | null

Added in version 8.7.0

Default brush applied to every tracked barcode when brushForTrackedBarcode() is not supplied. Omitting it, or passing null, keeps the overlay’s built-in default brush. To hide a tracked barcode, return null from brushForTrackedBarcode() or pass null to BarcodeBatchAioBasicOverlayHandle.setBrushForTrackedBarcode().

shouldShowScanAreaGuides
shouldShowScanAreaGuides?: boolean

Added in version 8.7.0

Whether the overlay renders scan-area guides. Defaults to false. Useful during development to check that the margins of the DataCaptureView are set correctly; not intended for production.

brushForTrackedBarcode(trackedBarcode)
brushForTrackedBarcode?(trackedBarcode: TrackedBarcode): Brush | null

Added in version 8.7.0

Returns the brush to draw for a newly tracked barcode, or null to draw nothing — in which case tapping the barcode has no effect and didTapTrackedBarcode() is not called. Called from the rendering thread.

didTapTrackedBarcode(trackedBarcode)
didTapTrackedBarcode?(trackedBarcode: TrackedBarcode): void

Added in version 8.7.0

Called when the user taps a tracked barcode. Called from the main thread.

BarcodeBatchAioAdvancedOverlayProps
interface BarcodeBatchAioAdvancedOverlayProps

Added in version 8.7.0

Configuration for the BarcodeBatchAdvancedOverlay, which renders application-supplied views per tracked barcode, passed through BarcodeBatchAioViewProps.advancedOverlay. The overlay is attached only when this prop is supplied; pass { enabled: false } to keep the prop shape while disabling the overlay at runtime. The callback props correspond to the BarcodeBatchAdvancedOverlayListener methods, without the overlay argument.

enabled
enabled?: boolean

Added in version 8.7.0

Whether to attach the advanced overlay. Defaults to true when the prop is supplied.

shouldShowScanAreaGuides
shouldShowScanAreaGuides?: boolean

Added in version 8.7.0

Whether the overlay renders scan-area guides. Defaults to false. Useful during development to visualize the active scan area; not intended for production.

viewForTrackedBarcode(trackedBarcode)
viewForTrackedBarcode?(trackedBarcode: TrackedBarcode): BarcodeBatchAdvancedOverlayView | null | Promise<BarcodeBatchAdvancedOverlayView | null>

Added in version 8.7.0

Returns the view to draw for a tracked barcode, or null to draw nothing. Called before anchorForTrackedBarcode() and offsetForTrackedBarcode(), and only for newly tracked barcodes that have no view yet; a view set through BarcodeBatchAioAdvancedOverlayHandle.setViewForTrackedBarcode() takes precedence.

didTapViewForTrackedBarcode(trackedBarcode)
didTapViewForTrackedBarcode?(trackedBarcode: TrackedBarcode): void

Added in version 8.7.0

Called when the user taps the view drawn for a tracked barcode.

anchorForTrackedBarcode(trackedBarcode)
anchorForTrackedBarcode?(trackedBarcode: TrackedBarcode): Anchor

Added in version 8.7.0

Returns the anchor point of the view drawn for a tracked barcode. Called after viewForTrackedBarcode() and before offsetForTrackedBarcode(), and only for newly tracked barcodes that have no anchor yet; an anchor set through BarcodeBatchAioAdvancedOverlayHandle.setAnchorForTrackedBarcode() takes precedence.

offsetForTrackedBarcode(trackedBarcode)
offsetForTrackedBarcode?(trackedBarcode: TrackedBarcode): PointWithUnit

Added in version 8.7.0

Returns the offset applied to the view drawn for a tracked barcode, relative to its anchor point. Called after viewForTrackedBarcode() and anchorForTrackedBarcode(), and only for newly tracked barcodes that have no offset yet; an offset set through BarcodeBatchAioAdvancedOverlayHandle.setOffsetForTrackedBarcode() takes precedence.

BarcodeBatchAioViewHandle
interface BarcodeBatchAioViewHandle

Added in version 8.7.0

Imperative operations on a BarcodeBatchAioView, reached through a ref on the component.

Overlay-scoped operations live under basicOverlay and advancedOverlay, each present only when its overlay is configured and enabled — so a method can never be called on an overlay that is not there.

reset()
reset(): Promise<void>

Added in version 8.7.0

Resets the mode’s tracking session, clearing every currently tracked barcode.

basicOverlay
basicOverlay?: BarcodeBatchAioBasicOverlayHandle

Added in version 8.7.0

Operations on the basic overlay. Omitted when the basic overlay is disabled.

advancedOverlay
advancedOverlay?: BarcodeBatchAioAdvancedOverlayHandle

Added in version 8.7.0

Operations on the advanced overlay. Omitted when the advanced overlay is not supplied or is disabled.

enable()
enable(): Promise<void>

Added in version 8.7.0

Turns scanning on now: enables the mode and turns the camera on. Automatic navigation and application-state handling may subsequently turn it off again.

disable()
disable(): Promise<void>

Added in version 8.7.0

Turns scanning off now: disables the mode and turns the camera off.

BarcodeBatchAioBasicOverlayHandle
interface BarcodeBatchAioBasicOverlayHandle

Added in version 8.7.0

Imperative operations scoped to the basic overlay, reached through BarcodeBatchAioViewHandle.basicOverlay. Present only while the basic overlay is enabled.

setBrushForTrackedBarcode(brush, trackedBarcode)
setBrushForTrackedBarcode(brush: Brush | null,
        trackedBarcode: TrackedBarcode): Promise<void>

Added in version 8.7.0

Overrides the brush used for a tracked barcode. Pass null to draw nothing, in which case tapping the barcode has no effect and BarcodeBatchAioBasicOverlayProps.didTapTrackedBarcode() is not called. Thread-safe.

clearTrackedBarcodeBrushes()
clearTrackedBarcodeBrushes(): Promise<void>

Added in version 8.7.0

Clears every per-barcode brush override set through setBrushForTrackedBarcode().

BarcodeBatchAioAdvancedOverlayHandle
interface BarcodeBatchAioAdvancedOverlayHandle

Added in version 8.7.0

Imperative operations scoped to the advanced overlay, reached through BarcodeBatchAioViewHandle.advancedOverlay. Present only while the advanced overlay is supplied and enabled.

setViewForTrackedBarcode(view, trackedBarcode)
setViewForTrackedBarcode(view: BarcodeBatchAdvancedOverlayView | Promise<BarcodeBatchAdvancedOverlayView>,
        trackedBarcode: TrackedBarcode): Promise<void>

Added in version 8.7.0

Sets the view drawn for a tracked barcode, taking precedence over BarcodeBatchAioAdvancedOverlayProps.viewForTrackedBarcode(); when set before that callback runs, the callback is not called. Pass null to remove the view from the overlay. Thread-safe.

setAnchorForTrackedBarcode(anchor, trackedBarcode)
setAnchorForTrackedBarcode(anchor: Anchor,
        trackedBarcode: TrackedBarcode): Promise<void>

Added in version 8.7.0

Sets the anchor point of the view drawn for a tracked barcode, taking precedence over BarcodeBatchAioAdvancedOverlayProps.anchorForTrackedBarcode(); when set before that callback runs, the callback is not called. Thread-safe.

setOffsetForTrackedBarcode(offset, trackedBarcode)
setOffsetForTrackedBarcode(offset: PointWithUnit,
        trackedBarcode: TrackedBarcode): Promise<void>

Added in version 8.7.0

Sets the offset applied to the view drawn for a tracked barcode, taking precedence over BarcodeBatchAioAdvancedOverlayProps.offsetForTrackedBarcode(); when set before that callback runs, the callback is not called. If the MeasureUnit of the offset is MeasureUnit.Fraction, the offset is relative to the view’s dimensions. Thread-safe.

clearTrackedBarcodeViews()
clearTrackedBarcodeViews(): Promise<void>

Added in version 8.7.0

Removes every view currently drawn by the advanced overlay. Thread-safe.

updateSizeOfTrackedBarcodeView(trackedBarcodeIdentifier, width, height)
updateSizeOfTrackedBarcodeView(trackedBarcodeIdentifier: number,
        width: number,
        height: number): Promise<void>

Added in version 8.7.0

Changes the width and height of the view drawn for a tracked barcode.