CameraHandle
What a Camera's ref holds: ref<CameraHandle>().
Verwendung
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>
</>
);
}Typdeklaration
export type CameraHandle = NativeViewHandle<CameraMethods>;Mitglieder 14
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
idschreibgeschützt | string | Ja | — |
parentschreibgeschützt | ElementHandle | Ja | — |
childrenschreibgeschützt | ElementHandle[] | Ja | — |
focus | () => void | Ja | — |
blur | () => void | Ja | — |
setProperty | <K extends keyof ElementProperties>(key: K, value: ElementProperties[K] | null) => void | Ja | 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 | Ja | — |
removeEventListener | (type: string, fn: (e: KuitoNativeEvent) => void, options?: boolean | { capture?: boolean;}) => void | Ja | — |
dispatchEvent | (event: { type: string; bubbles?: boolean; cancelable?: boolean;}) => boolean | Ja | 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> | Ja | Takes a picture with the current flash; the view must be ready. |
startRecording | (options?: RecordingOptions) => Promise<CameraRecording> | Ja | 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> | Ja | Ends the recording, and resolves with the same video startRecording does. |
pausePreview | () => Promise<void> | Ja | Freezes the preview and stops the camera, keeping the view. |
resumePreview | () => Promise<void> | Ja | — |
focus — Methodensignaturen
Signaturen
(): voidParameter
Keine Parameter.
Rückgabe
void
blur — Methodensignaturen
Signaturen
(): voidParameter
Keine Parameter.
Rückgabe
void
setProperty — Methodensignaturen
Signaturen
<K extends keyof ElementProperties>(key: K, value: ElementProperties[K] | null): voidTypparameter
| Name | Einschränkung | Standard |
|---|---|---|
K | keyof ElementProperties | — |
Parameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
key | K | Ja | — |
value | ElementProperties[K] | Ja | — |
Rückgabe
void
addEventListener — Methodensignaturen
Signaturen
(type: string, fn: (e: KuitoNativeEvent) => void, options?: boolean | { capture?: boolean; once?: boolean; signal?: AbortSignal; }): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
type | string | Ja | — |
fn | (e: KuitoNativeEvent) => void | Ja | — |
options | boolean | { capture?: boolean; once?: boolean; signal?: AbortSignal;} | Nein | — |
Rückgabe
void
removeEventListener — Methodensignaturen
Signaturen
(type: string, fn: (e: KuitoNativeEvent) => void, options?: boolean | { capture?: boolean; }): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
type | string | Ja | — |
fn | (e: KuitoNativeEvent) => void | Ja | — |
options | boolean | { capture?: boolean;} | Nein | — |
Rückgabe
void
dispatchEvent — Methodensignaturen
Signaturen
(event: { type: string; bubbles?: boolean; cancelable?: boolean; }): booleanParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | { type: string; bubbles?: boolean; cancelable?: boolean;} | Ja | — |
Rückgabe
boolean
takePicture — Methodensignaturen
Signaturen
(options?: PictureOptions): Promise<CameraPicture>Parameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
options | SpecPictureOptions | Nein | — |
Rückgabe
Promise<SpecCameraPicture>
startRecording — Methodensignaturen
Signaturen
(options?: RecordingOptions): Promise<CameraRecording>Parameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
options | SpecRecordingOptions | Nein | — |
Rückgabe
Promise<SpecCameraRecording>
stopRecording — Methodensignaturen
Signaturen
(): Promise<CameraRecording>Parameter
Keine Parameter.
Rückgabe
Promise<SpecCameraRecording>
pausePreview — Methodensignaturen
Signaturen
(): Promise<void>Parameter
Keine Parameter.
Rückgabe
Promise<void>
resumePreview — Methodensignaturen
Signaturen
(): Promise<void>Parameter
Keine Parameter.
Rückgabe
Promise<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.