Barcode AR AIO View

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

BarcodeArAioView
class BarcodeArAioView

Added in version 8.7.0

An all-in-one React component for MatrixScan AR. Rendering this single element replaces the manual assembly of a DataCaptureContext, a BarcodeAr mode and a BarcodeArView — 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 BarcodeArAioViewProps. To gain manual control over the component, attach a React ref typed as BarcodeArAioViewHandle.

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 AR Get Started guide.

BarcodeArAioViewProps
interface BarcodeArAioViewProps

Added in version 8.7.0

Configuration for BarcodeArAioView.

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

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

Added in version 8.7.0

Called on each session update with every newly-added tracked barcode. Each entry is a TrackedBarcode, taken from BarcodeArSession.addedTrackedBarcodes.

Derived from the same native BarcodeArListener.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: BarcodeArSession,
        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 BarcodeArListener.didUpdateSession() event.

symbologies
symbologies?: Symbology[]

Added in version 8.7.0

Symbologies to enable. Shorthand for BarcodeArSettings.enabledSymbologies; ignored when settings is set.

settings
settings?: BarcodeArSettings | null

Added in version 8.7.0

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

viewSettings
viewSettings?: BarcodeArViewSettings | null

Added in version 8.7.0

View-level settings, as a BarcodeArViewSettings object.

cameraSettings
cameraSettings?: CameraSettings | null

Added in version 8.7.0

Camera settings for the view’s own camera. Omit to use BarcodeAr.createRecommendedCameraSettings().

highlightProvider
highlightProvider?: BarcodeArHighlightProvider | null

Added in version 8.7.0

Provider that supplies highlight information for barcodes in the view. If null, a default provider is used, which returns a predefined highlight for each barcode.

annotationProvider
annotationProvider?: BarcodeArAnnotationProvider | null

Added in version 8.7.0

Provider that supplies annotation information for barcodes in the view. If null, no annotation is displayed for any barcode.

uiListener
uiListener?: BarcodeArViewUiListener | null

Added in version 8.7.0

Listener called whenever a barcode highlight is tapped in the view.

barcodeFilter
barcodeFilter?: BarcodeArFilter | null

Added in version 8.7.0

Filter that determines which barcodes are visible in the BarcodeArSession. Pass null to remove the filter and show all barcodes. See BarcodeArFilter for details on implementing a custom filter.

feedback
feedback?: BarcodeArFeedback

Added in version 8.7.0

Sound and vibration feedback emitted on scan, as a BarcodeArFeedback. Omit to use the SDK default, which enables both sound (a beep) and vibration.

shouldShowTorchControl
shouldShowTorchControl?: boolean

Added in version 8.7.0

Whether the torch control button is shown. Defaults to false.

torchControlPosition
torchControlPosition?: Anchor

Added in version 8.7.0

Position of the torch control button. Defaults to Anchor.TopLeft.

shouldShowZoomControl
shouldShowZoomControl?: boolean

Added in version 8.7.0

Whether the zoom control button is shown.

zoomControlPosition
zoomControlPosition?: Anchor

Added in version 8.7.0

Position of the zoom control button. Defaults to Anchor.BottomRight.

shouldShowCameraSwitchControl
shouldShowCameraSwitchControl?: boolean

Added in version 8.7.0

Whether the camera switch control button is shown.

cameraSwitchControlPosition
cameraSwitchControlPosition?: Anchor

Added in version 8.7.0

Position of the camera switch control button. Defaults to Anchor.TopRight.

shouldShowMacroModeControl
shouldShowMacroModeControl?: boolean

Added in version 8.7.0

Whether the macro mode control button is shown.

macroModeControlPosition
macroModeControlPosition?: Anchor

Added in version 8.7.0

Position of the macro mode control button. Defaults to Anchor.TopRight.

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.

BarcodeArAioViewHandle.enable() and BarcodeArAioViewHandle.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 native view and passes nothing else through.

children
children?: ReactNode

Added in version 8.7.0

Content rendered on top of the scanning UI.

BarcodeArAioViewHandle
interface BarcodeArAioViewHandle

Added in version 8.7.0

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

start()
start(): Promise<void>

Added in version 8.7.0

Starts the scanning process.

stop()
stop(): Promise<void>

Added in version 8.7.0

Stops the scanning process.

pause()
pause(): Promise<void>

Added in version 8.7.0

Pauses the scanning process.

reset()
reset(): Promise<void>

Added in version 8.7.0

Removes all current highlights and annotations.

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.