CameraProps
Props of Camera: which camera, its light, zoom and mode, the codes to scan, and its events.
Verwendung
Pause and resume a camera preview.
Dieser Typ wird verwendet von 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>
</>
);
}Typdeklaration
export type CameraProps = {
/** `back` by default. */
facing?: CameraFacing;
/** `off` by default. */
flash?: CameraFlash;
/** Keeps the light on while the preview runs. */
torch?: boolean;
/** From 0 (none) to 1 (the most the camera can), linearly. 0 by default. */
zoom?: number;
/** `picture` by default. Record videos in `video`. */
mode?: CameraMode;
/** Records videos without sound, and without asking for the microphone. */
mute?: boolean;
/** Scans for these codes while the preview runs. */
barcodes?: BarcodeType[];
/** The preview is running: the camera can take pictures and record. */
onReady?: (event: CameraReadyEvent) => void;
onError?: (event: CameraErrorEvent) => void;
/** Each time a code of `barcodes` comes into view. */
onBarcode?: (event: BarcodeEvent) => void;
};Mitglieder 10
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
facing | CameraFacing | Nein | back by default. |
flash | CameraFlash | Nein | off by default. |
torch | boolean | Nein | Keeps the light on while the preview runs. |
zoom | number | Nein | From 0 (none) to 1 (the most the camera can), linearly. 0 by default. |
mode | CameraMode | Nein | picture by default. Record videos in video. |
mute | boolean | Nein | Records videos without sound, and without asking for the microphone. |
barcodes | BarcodeType[] | Nein | Scans for these codes while the preview runs. |
onReady | (event: CameraReadyEvent) => void | Nein | The preview is running: the camera can take pictures and record. |
onError | (event: CameraErrorEvent) => void | Nein | — |
onBarcode | (event: BarcodeEvent) => void | Nein | Each time a code of barcodes comes into view. |
onReady — Methodensignaturen
Signaturen
(event: CameraReadyEvent): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | CameraReadyEvent | Ja | — |
Rückgabe
void
onError — Methodensignaturen
Signaturen
(event: CameraErrorEvent): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | CameraErrorEvent | Ja | — |
Rückgabe
void
onBarcode — Methodensignaturen
Signaturen
(event: BarcodeEvent): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | BarcodeEvent | Ja | — |
Rückgabe
void
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.