Utilização

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

Este tipo é usado por 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]);
}

Declaração do tipo

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

Membros 6

NomeTipoObrigatórioDescrição
mediaTypesPickerMediaType | PickerMediaType[]NãoWhat the picker offers: 'images' (the default), 'videos', or both.
qualitynumberNãoJPEG quality of written images, 0 to 1. 1, the default, keeps the most detail.
maxWidthnumberNãoImages wider than this are scaled down to fit, keeping their aspect ratio. In pixels.
maxHeightnumberNãoImages taller than this are scaled down to fit, keeping their aspect ratio. In pixels.
allowsEditingbooleanNãoiOS: crop the image, or trim the video, in the system editor before it resolves.
selectionLimitnumberNãoHow many assets the user may pick: 1, the default, or 0 for no limit.
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.