Verwendung

Pick a photo and hand its local file to an upload function.

Dieser Typ wird verwendet von mediaPicker.pick

tsx
// Pick a photo and hand its local file to an upload function.
import { mediaPicker, type MediaAsset, type MediaType } from 'kuito';

export async function choosePhoto(upload: (asset: MediaAsset) => Promise<void>) {
  const mediaTypes: MediaType[] = ['images'];
  const result = await mediaPicker.pick({ mediaTypes });
  if (!result.canceled && result.assets[0]) await upload(result.assets[0]);
}

Typdeklaration

ts
export type PickOptions = CaptureOptions & {
  /** How many assets the user may pick: 1, the default, or 0 for no limit. */
  selectionLimit?: number;
};

Mitglieder 6

NameTypErforderlichBeschreibung
mediaTypesPickerMediaType | PickerMediaType[]NeinWhat the picker offers: 'images' (the default), 'videos', or both.
qualitynumberNeinJPEG quality of written images, 0 to 1. 1, the default, keeps the most detail.
maxWidthnumberNeinImages wider than this are scaled down to fit, keeping their aspect ratio. In pixels.
maxHeightnumberNeinImages taller than this are scaled down to fit, keeping their aspect ratio. In pixels.
allowsEditingbooleanNeiniOS: crop the image, or trim the video, in the system editor before it resolves.
selectionLimitnumberNeinHow many assets the user may pick: 1, the default, or 0 for no limit.
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.