Verwendung

Pause and resume a camera preview.

tsx
// 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

ts
export type CameraHandle = NativeViewHandle<CameraMethods>;

Mitglieder 14

NameTypErforderlichBeschreibung
idschreibgeschütztstringJa—
parentschreibgeschütztElementHandleJa—
childrenschreibgeschütztElementHandle[]Ja—
focus() => voidJa—
blur() => voidJa—
setProperty<K extends keyof ElementProperties>(key: K, value: ElementProperties[K] | null) => voidJaSets 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;}) => voidJa—
removeEventListener(type: string, fn: (e: KuitoNativeEvent) => void, options?: boolean | { capture?: boolean;}) => voidJa—
dispatchEvent(event: { type: string; bubbles?: boolean; cancelable?: boolean;}) => booleanJaSends 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>JaTakes a picture with the current flash; the view must be ready.
startRecording(options?: RecordingOptions) => Promise<CameraRecording>JaStarts 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>JaEnds the recording, and resolves with the same video startRecording does.
pausePreview() => Promise<void>JaFreezes the preview and stops the camera, keeping the view.
resumePreview() => Promise<void>Ja—
focus — Methodensignaturen

Signaturen

ts
(): void

Parameter

Keine Parameter.

Rückgabe

void

blur — Methodensignaturen

Signaturen

ts
(): void

Parameter

Keine Parameter.

Rückgabe

void

setProperty — Methodensignaturen

Signaturen

ts
<K extends keyof ElementProperties>(key: K, value: ElementProperties[K] | null): void

Typparameter

NameEinschränkungStandard
Kkeyof ElementProperties—

Parameter

NameTypErforderlichBeschreibung
keyKJa—
valueElementProperties[K]Ja—

Rückgabe

void

addEventListener — Methodensignaturen

Signaturen

ts
(type: string, fn: (e: KuitoNativeEvent) => void, options?: boolean | { capture?: boolean; once?: boolean; signal?: AbortSignal; }): void

Parameter

NameTypErforderlichBeschreibung
typestringJa—
fn(e: KuitoNativeEvent) => voidJa—
optionsboolean | { capture?: boolean; once?: boolean; signal?: AbortSignal;}Nein—

Rückgabe

void

removeEventListener — Methodensignaturen

Signaturen

ts
(type: string, fn: (e: KuitoNativeEvent) => void, options?: boolean | { capture?: boolean; }): void

Parameter

NameTypErforderlichBeschreibung
typestringJa—
fn(e: KuitoNativeEvent) => voidJa—
optionsboolean | { capture?: boolean;}Nein—

Rückgabe

void

dispatchEvent — Methodensignaturen

Signaturen

ts
(event: { type: string; bubbles?: boolean; cancelable?: boolean; }): boolean

Parameter

NameTypErforderlichBeschreibung
event{ type: string; bubbles?: boolean; cancelable?: boolean;}Ja—

Rückgabe

boolean

takePicture — Methodensignaturen

Signaturen

ts
(options?: PictureOptions): Promise<CameraPicture>

Parameter

NameTypErforderlichBeschreibung
optionsSpecPictureOptionsNein—

Rückgabe

Promise<SpecCameraPicture>

startRecording — Methodensignaturen

Signaturen

ts
(options?: RecordingOptions): Promise<CameraRecording>

Parameter

NameTypErforderlichBeschreibung
optionsSpecRecordingOptionsNein—

Rückgabe

Promise<SpecCameraRecording>

stopRecording — Methodensignaturen

Signaturen

ts
(): Promise<CameraRecording>

Parameter

Keine Parameter.

Rückgabe

Promise<SpecCameraRecording>

pausePreview — Methodensignaturen

Signaturen

ts
(): Promise<void>

Parameter

Keine Parameter.

Rückgabe

Promise<void>

resumePreview — Methodensignaturen

Signaturen

ts
(): 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.