CameraHandle
What a Camera's ref holds: ref<CameraHandle>().
Utilização
Pause and resume a camera preview.
// 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 CameraHandle = NativeViewHandle<CameraMethods>;Membros 14
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
idsó de leitura | string | Sim | — |
parentsó de leitura | ElementHandle | Sim | — |
childrensó de leitura | ElementHandle[] | Sim | — |
focus | () => void | Sim | — |
blur | () => void | Sim | — |
setProperty | <K extends keyof ElementProperties>(key: K, value: ElementProperties[K] | null) => void | Sim | Sets a native prop on the view now, until its binding writes it again. |
addEventListener | (type: string, fn: (e: KuitoNativeEvent) => void, options?: boolean | { capture?: boolean; once?: boolean; signal?: AbortSignal;}) => void | Sim | — |
removeEventListener | (type: string, fn: (e: KuitoNativeEvent) => void, options?: boolean | { capture?: boolean;}) => void | Sim | — |
dispatchEvent | (event: { type: string; bubbles?: boolean; cancelable?: boolean;}) => boolean | Sim | Sends an event through the tree, capture to bubble, as a native one travels:
a KuitoCustomEvent, or any object with a type. False when a listener
called preventDefault() on a cancelable event. |
takePicture | (options?: PictureOptions) => Promise<CameraPicture> | Sim | Takes a picture with the current flash; the view must be ready. |
startRecording | (options?: RecordingOptions) => Promise<CameraRecording> | Sim | Starts recording, in video mode. Resolves with the video once the
recording ends: stopRecording, maxDuration, the app leaving the
foreground, or the view unmounting. |
stopRecording | () => Promise<CameraRecording> | Sim | Ends the recording, and resolves with the same video startRecording does. |
pausePreview | () => Promise<void> | Sim | Freezes the preview and stops the camera, keeping the view. |
resumePreview | () => Promise<void> | Sim | — |
focus — assinaturas de método
Assinaturas
(): voidParâmetros
Sem parâmetros.
Devolve
void
blur — assinaturas de método
Assinaturas
(): voidParâmetros
Sem parâmetros.
Devolve
void
setProperty — assinaturas de método
Assinaturas
<K extends keyof ElementProperties>(key: K, value: ElementProperties[K] | null): voidParâmetros de tipo
| Nome | Restrição | Predefinição |
|---|---|---|
K | keyof ElementProperties | — |
Parâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
key | K | Sim | — |
value | ElementProperties[K] | Sim | — |
Devolve
void
addEventListener — assinaturas de método
Assinaturas
(type: string, fn: (e: KuitoNativeEvent) => void, options?: boolean | { capture?: boolean; once?: boolean; signal?: AbortSignal; }): voidParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
type | string | Sim | — |
fn | (e: KuitoNativeEvent) => void | Sim | — |
options | boolean | { capture?: boolean; once?: boolean; signal?: AbortSignal;} | Não | — |
Devolve
void
removeEventListener — assinaturas de método
Assinaturas
(type: string, fn: (e: KuitoNativeEvent) => void, options?: boolean | { capture?: boolean; }): voidParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
type | string | Sim | — |
fn | (e: KuitoNativeEvent) => void | Sim | — |
options | boolean | { capture?: boolean;} | Não | — |
Devolve
void
dispatchEvent — assinaturas de método
Assinaturas
(event: { type: string; bubbles?: boolean; cancelable?: boolean; }): booleanParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
event | { type: string; bubbles?: boolean; cancelable?: boolean;} | Sim | — |
Devolve
boolean
takePicture — assinaturas de método
Assinaturas
(options?: PictureOptions): Promise<CameraPicture>Parâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
options | SpecPictureOptions | Não | — |
Devolve
Promise<SpecCameraPicture>
startRecording — assinaturas de método
Assinaturas
(options?: RecordingOptions): Promise<CameraRecording>Parâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
options | SpecRecordingOptions | Não | — |
Devolve
Promise<SpecCameraRecording>
stopRecording — assinaturas de método
Assinaturas
(): Promise<CameraRecording>Parâmetros
Sem parâmetros.
Devolve
Promise<SpecCameraRecording>
pausePreview — assinaturas de método
Assinaturas
(): Promise<void>Parâmetros
Sem parâmetros.
Devolve
Promise<void>
resumePreview — assinaturas de método
Assinaturas
(): Promise<void>Parâmetros
Sem parâmetros.
Devolve
Promise<void>
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.