BarcodeEvent
Tells a Camera's app which code came into view, what it encodes and where it is in the preview.
Usage
Pause and resume a camera preview.
This type is used by Camera
// Pause and resume a camera preview.
import { Button, Camera, ref, type CameraHandle } from 'kuito';
function Scanner() {
// A plain ref holds the handle; cameraRef() adds ready and error signals.
const camera = ref<CameraHandle>();
return (
<>
<Camera ref={camera} flex={1} />
<Button onPress={() => void camera.current?.pausePreview()}>Pause</Button>
<Button onPress={() => void camera.current?.resumePreview()}>Resume</Button>
</>
);
}Type declaration
export type BarcodeEvent = NativeViewEvent<
'barcode',
{
/** The event's `type` is `barcodeScanned`; this is the code's. */
format: BarcodeType;
data: string;
/** In the view's points, from its top-left corner. */
bounds: { x: number; y: number; width: number; height: number };
}
>;Members 6
| Name | Type | Required | Description |
|---|---|---|---|
type | "barcode" | Yes | — |
target | unknown | Yes | — |
isTrusted | boolean | Yes | — |
format | BarcodeType | Yes | The event's type is barcodeScanned; this is the code's. |
data | string | Yes | — |
bounds | { x: number; y: number; width: number; height: number;} | Yes | In the view's points, from its top-left corner. |
bounds — nested fields
bounds fields
| Name | Type | Required | Description |
|---|---|---|---|
x | number | Yes | — |
y | number | Yes | — |
width | number | Yes | — |
height | number | Yes | — |
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.