Tally UI

CameraScanButton

CameraScanButton is the icon button that opens and closes the camera barcode scanner panel.

Import

import { CameraScanButton } from '@tallyui/components';

Usage

<CameraScanButton open={scannerOpen} onPress={() => setScannerOpen((open) => !open)} />

A scan icon button with a tooltip, ported from WCPOS v2. It does not open anything itself: the app keeps the open state and shows CameraScannerPanel when it is true. While open is true the button is drawn in the secondary style, its label and tooltip read "Close barcode scanner" (otherwise "Scan barcode with camera"), and it reports itself as expanded to assistive technology.

Props

PropTypeDefaultDescription
openbooleanrequiredThe scanner is showing, so the button closes it
onPress() => voidrequiredCalled on press; the app toggles the scanner
testIDstring'camera-scan-button'Test id of the button

On this page