MediaPickerResult
What the media picker ended with: the assets the user chose, or a cancel.
Usage
Capture a profile photo with the system camera UI.
This type is used by 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>
);
}Type declaration
export type MediaPickerResult =
| { canceled: true; assets: null }
| { canceled: false; assets: MediaAsset[] };Members 2
| Name | Type | Required | Description |
|---|---|---|---|
canceled | boolean | Yes | — |
assets | PickedAsset[] | Yes | — |
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.