MindeesUI
ComponentsSpecialised

Barcode

A barcode and QR scanner built on top of the Camera wrapper with a strongly-typed onScanned callback.

Barcode is a thin convenience layer over Camera that routes the underlying onBarcodeScanned event into a strongly-typed onScanned callback. Because it composes Camera, it inherits the same peer requirement: when the peer isn't installed, Camera renders a MissingPeer fallback with the exact install command instead of crashing.

Peer dependency

pnpm add expo-camera

When the peer isn't installed, the component renders a MissingPeer fallback with the exact install command — this means you can use it conditionally without crashing.

Import

import { Barcode } from '@mindees/ui';

Usage

<Barcode types={['qr', 'ean13']} onScanned={({ type, data }) => console.log(type, data)} />

Props

PropTypeDefaultDescription
onScanned(result: { type: string; data: string }) => voidFires once per detected symbol with its type and decoded data.
typesreadonly ('qr' | 'ean13' | 'ean8' | 'code128' | 'code39' | 'upc_a' | 'upc_e' | 'pdf417' | 'datamatrix')[]allRestrict scanning to specific symbologies.

Any remaining props are forwarded to the underlying Camera (and through it to expo-camera's CameraView).

Accessibility

Scanning is a sighted-only viewfinder activity. Provide an accessibilityLabel on the surrounding container describing what the user should aim at, and pair the scanner with a non-camera fallback (manual code entry) where possible.

On this page