BarcodeEvent
Tells a Camera's app which code came into view, what it encodes and where it is in the preview.
Utilisation
Pause and resume a camera preview.
Ce type est utilisé par 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>
</>
);
}Déclaration du type
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 };
}
>;Membres 6
| Nom | Type | Requis | Description |
|---|---|---|---|
type | "barcode" | Oui | — |
target | unknown | Oui | — |
isTrusted | boolean | Oui | — |
format | BarcodeType | Oui | The event's type is barcodeScanned; this is the code's. |
data | string | Oui | — |
bounds | { x: number; y: number; width: number; height: number;} | Oui | In the view's points, from its top-left corner. |
bounds — champs imbriqués
bounds champs
| Nom | Type | Requis | Description |
|---|---|---|---|
x | number | Oui | — |
y | number | Oui | — |
width | number | Oui | — |
height | number | Oui | — |
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.