Native only
Code scanner
QR/barcode viewfinder · simulated emits a sample payload
function CodeScannerDemo() { const [open, setOpen] = React.useState(false); const [last, setLast] = React.useState<string | null>(null); return ( <View className="w-full gap-3"> {open ? ( <CodeScanner ratio={4 / 3} onScan={(value) => { setLast(value); setOpen(false); }} onClose={() => setOpen(false)} /> ) : ( <Button variant="secondary" onPress={() => setOpen(true)}> <Text>Open the scanner</Text> </Button> )} <Text className="text-muted-foreground text-sm"> {last ? `Scanned: ${last}` : 'Nothing scanned yet.'} </Text> </View> );}Usage
QR and barcode viewfinder. Without a camera it shows the same framing overlay plus a button that emits a sample payload, so the flow behind it stays demonstrable.
API
<CodeScanner onScan types? hint? ratio? continuous? simulatedValues? simulate? />Get it
Already in every copy of the native kit:
import { CodeScanner } from '@/components/kit/code-scanner';Details
- Exports
CodeScanner- Packages
- expo-camera@~57.0.5, lucide-react-native@^1.21.0
- Installs with
- @halftone-native/button, @halftone-native/icon, @halftone-native/lib-haptics, @halftone-native/lib-native-context, @halftone-native/lib-utils, @halftone-native/permission-primer, @halftone-native/placeholder, @halftone-native/text
- Also searched as
- qr, barcode, scan, camera viewfinder
- Registry JSON
- /r/native/code-scanner.json
Agents: the whole registry is at /llms.txt.