ActionSheetButton
One choice an action sheet offers, which may be the cancel choice, a destructive one or a dimmed one the user can't pick.
Utilisation
Offer actions for an item
Ce type est utilisé par actionSheet
import { Pressable, Text, actionSheet } from 'kuito';
export function EpisodeMenu(props: {
id: string;
title: string;
onDelete: (id: string) => Promise<void>;
}) {
const remove = { text: 'Delete', style: 'destructive' } as const;
return (
<Pressable
onPress={async (event) => {
const picked = await actionSheet({
buttons: [
{ text: 'Share' },
{ text: 'Add to list' },
remove,
{ text: 'Cancel', style: 'cancel' },
],
title: props.title,
anchor: { x: event.pageX ?? 0, y: event.pageY ?? 0 },
});
if (picked === remove) await props.onDelete(props.id);
}}
>
<Text>More</Text>
</Pressable>
);
}Déclaration du type
export type ActionSheetButton = {
text: string;
/**
* `cancel` is shown apart, at the bottom, and is what dismissing the sheet
* picks; at most one button is `cancel`. `destructive` is drawn in red.
*/
style?: AlertButtonStyle;
/** Shown dimmed; it can't be picked. */
disabled?: boolean;
};Membres 3
| Nom | Type | Requis | Description |
|---|---|---|---|
text | string | Oui | — |
style | AlertButtonStyle | Non | cancel is shown apart, at the bottom, and is what dismissing the sheet
picks; at most one button is cancel. destructive is drawn in red. |
disabled | boolean | Non | Shown dimmed; it can't be picked. |
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.