Skip to main content

ActionSheet action item component

Effect demonstration

<ActionSheet
data={[
{ text: 'Operation 1', onPress: () => console.log(1) },
{ text: 'Operation 2', onPress: () => console.log(2) },
{ text: 'Operation 3', onPress: () => console.log(3), render: (text, type) => <Text>{text}</Text> },
{ text: 'Operation 4', onPress: () => console.log(4), type: 'danger' },
]}
onCancel={() => setVisible(false)}
visible={visible}
/>

API

ActionSheet Properties

PropertiesRequiredDescriptionTypeDefault Value
itemstrueAction item listActionSheetItem[][]
visibletrueWhether to display the operation panelboolean
activeOpacityfalseOpacity when pressednumber0.6
onCanceltrueClose the operation panel() => void
cancelTextfalseClose button textstringCancel

ActionSheetItem Properties

PropertiesRequiredDescriptionTypeDefault Value
texttrueAction textstring
onPresstrueAction item click event() => void
typefalseAction item type. danger represents a warning operationdefault | danger
renderfalseCustom rendering operation items(text: string, type?: 'default' | 'danger') => ReactNode