CaptureOptions
Tunes what the system camera captures for mediaPicker.capture(): images or videos, JPEG quality, a maximum size and the iOS editor.
Utilisation
Capture a profile photo with the system camera UI.
Ce type est utilisé par mediaPicker.capture
// 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>
);
}Déclaration du type
export type CaptureOptions = {
/** What the picker offers: `'images'` (the default), `'videos'`, or both. */
mediaTypes?: MediaType | MediaType[];
/** JPEG quality of written images, 0 to 1. 1, the default, keeps the most detail. */
quality?: number;
/** Images wider than this are scaled down to fit, keeping their aspect ratio. In pixels. */
maxWidth?: number;
/** Images taller than this are scaled down to fit, keeping their aspect ratio. In pixels. */
maxHeight?: number;
/** iOS: crop the image, or trim the video, in the system editor before it resolves. */
allowsEditing?: boolean;
};Membres 5
| Nom | Type | Requis | Description |
|---|---|---|---|
mediaTypes | PickerMediaType | PickerMediaType[] | Non | What the picker offers: 'images' (the default), 'videos', or both. |
quality | number | Non | JPEG quality of written images, 0 to 1. 1, the default, keeps the most detail. |
maxWidth | number | Non | Images wider than this are scaled down to fit, keeping their aspect ratio. In pixels. |
maxHeight | number | Non | Images taller than this are scaled down to fit, keeping their aspect ratio. In pixels. |
allowsEditing | boolean | Non | iOS: crop the image, or trim the video, in the system editor before it resolves. |
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.