Verwendung

Capture a profile photo with the system camera UI.

tsx
// Capture a profile photo with the system camera UI.
import { Button, Image, VStack, mediaPicker, signal } from 'kuito';

export function ProfilePhoto() {
  const uri = signal<string | null>(null);
  async function capture() {
    try {
      const result = await mediaPicker.capture({ mediaTypes: ['images'] });
      if (!result.canceled) uri.value = result.assets[0]?.uri ?? null;
    } catch (error) {
      console.error('Camera unavailable', error);
    }
  }
  return (
    <VStack>
      <Button onPress={() => void capture()}>Take profile photo</Button>
      {uri.value ? <Image src={uri.value} width={96} height={96} /> : null}
    </VStack>
  );
}

Signaturen

ts
(options?: CaptureOptions): Promise<MediaPickerResult>

Parameter

NameTypErforderlichBeschreibung
optionsCaptureOptionsNein—
Standard: {}

Rückgabe

Promise<MediaPickerResult>

Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.