CameraProps
Props of Camera: which camera, its light, zoom and mode, the codes to scan, and its events.
Utilização
Pause and resume a camera preview.
Este tipo é usado por 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>
</>
);
}Declaração do tipo
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;
};Membros 10
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
facing | CameraFacing | Não | back by default. |
flash | CameraFlash | Não | off by default. |
torch | boolean | Não | Keeps the light on while the preview runs. |
zoom | number | Não | From 0 (none) to 1 (the most the camera can), linearly. 0 by default. |
mode | CameraMode | Não | picture by default. Record videos in video. |
mute | boolean | Não | Records videos without sound, and without asking for the microphone. |
barcodes | BarcodeType[] | Não | Scans for these codes while the preview runs. |
onReady | (event: CameraReadyEvent) => void | Não | The preview is running: the camera can take pictures and record. |
onError | (event: CameraErrorEvent) => void | Não | — |
onBarcode | (event: BarcodeEvent) => void | Não | Each time a code of barcodes comes into view. |
onReady — assinaturas de método
Assinaturas
(event: CameraReadyEvent): voidParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
event | CameraReadyEvent | Sim | — |
Devolve
void
onError — assinaturas de método
Assinaturas
(event: CameraErrorEvent): voidParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
event | CameraErrorEvent | Sim | — |
Devolve
void
onBarcode — assinaturas de método
Assinaturas
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.