ActionSheet
Cross platform Action Sheet, with a support for native iOS solutions
(code example)
#
Usage<ActionSheet title={'Title'} message={'Message goes here'} cancelButtonIndex={3} destructiveButtonIndex={0} options={[ {label: '', onPress: }, {label: '', onPress: }, {label: 'Cancel', onPress: () => console.log('cancel')0} ]}/>
#
API#
cancelButtonIndexIndex of the option represents the cancel action (to be displayed as the separated bottom bold button)
number
#
containerStyleAdd or override style of the action sheet (wraps the title and actions)
ViewStyle
#
destructiveButtonIndexIndex of the option represents the destructive action (will display red text. Usually used for delete or abort actions)
number
#
dialogStyleAdd or override style of the dialog wrapping the action sheet
ViewStyle
#
messageMessage of the action sheet
string
#
onDismissCalled when dismissing the action sheet (usually used for setting 'visible' prop to false)
DialogProps['onDismiss']
#
onModalDismissed#
iOS only, modal onlyCalled once the modal has been dismissed
DialogProps['onDialogDismissed']
#
optionsList of options for the action sheet, follows the Button prop types (supply 'label' string and 'onPress' function)
Array<ButtonProps>
#
optionsStyleAdd or override style of the options list
ViewStyle
#
renderAction#
You will need to call 'onOptionPress' so the option's 'onPress' will be calledRender custom action
(
option: ButtonProps,
index: number,
onOptionPress: ActionSheetOnOptionPress
) => JSX.Element
#
renderTitleRender custom title
() => JSX.Element
#
showCancelButtonWhen passed (only with useNativeIOS), will display a cancel button at the bottom (overrides cancelButtonIndex)
boolean
#
testIDThe test id for e2e tests
string
#
title#
If both 'title' and 'message' are not passed will not render the title view at allTitle of the action sheet
string
#
useNativeIOSShould use the native action sheet for iOS
boolean
#
useSafeAreaIn iOS, use safe area, in case component attached to the bottom
boolean
#
visibleWhether to show the action sheet or not
boolean