Skip to content
nexubDesign System
v11.9.0

Components · Mobile only · Inputs

QR Scanner

AlphaiOS & Android

Scans QR codes with the camera (optional peer expo-camera): permission flow, torch, a haptic and an announcement on each code, and manual entry always one tap away. The preview has no camera, so it shows the manual-entry fallback.

Usage

@nexub/react-nativeWeb: QRCode shows a code; reading one needs the device camera
TSX
import { QRScanner } from '@nexub/react-native';

<QRScanner onScan={redeem} fallback={<TextField label="Code" value={code} onChangeText={setCode} />} />

Interactive preview of @nexub/react-native rendered for the web. Native chrome (switches, pickers, Liquid Glass) looks like the platform on a device.

On device

QR Scanner on iPhone (iOS simulator)

iPhone (iOS simulator)

QR Scanner on Pixel (Android emulator)

Pixel (Android emulator)

Screenshots from the latest CI run of the showcase app; the live frame renders the same code for the web.

QRScanner props

QRScanner props (React Native)
PropTypeDefaultDescription
onScanrequired(value: string) => void—Called with the text of each code found. The same code is not repeated within two seconds.
fallbackReact.ReactNode—Manual entry, e.g. a TextField and a button. Shown when there is no camera or no permission, and one tap away while scanning.
pausedboolean—Stops the camera and ignores codes, e.g. while the last one is checked.
torchboolean—Controlled torch.
defaultTorchbooleanfalse—
onTorchChange(on: boolean) => void——
instructionsstringmessages.scanInstructionsHint over the camera.
styleStyleProp<ViewStyle>——