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β
cancelButtonIndexβ
Index of the option represents the cancel action (to be displayed as the separated bottom bold button)
number
containerStyleβ
Add or override style of the action sheet (wraps the title and actions)
ViewStyle
destructiveButtonIndexβ
Index of the option represents the destructive action (will display red text. Usually used for delete or abort actions)
number
dialogStyleβ
Add or override style of the dialog wrapping the action sheet
ViewStyle
messageβ
Message of the action sheet
string
onDismissβ
Called when dismissing the action sheet (usually used for setting 'visible' prop to false)
DialogProps['onDismiss']
onModalDismissedβ
iOS only, modal onlyβ
Called once the modal has been dismissed
DialogProps['onDialogDismissed']
optionsβ
List of options for the action sheet, follows the Button prop types (supply 'label' string and 'onPress' function)
Array<ButtonProps>
optionsStyleβ
Add or override style of the options list
ViewStyle
renderActionβ
You will need to call 'onOptionPress' so the option's 'onPress' will be calledβ
Render custom action
( option: ButtonProps, index: number, onOptionPress: ActionSheetOnOptionPress ) => JSX.Element
renderTitleβ
Render custom title
() => JSX.Element
showCancelButtonβ
When passed (only with useNativeIOS), will display a cancel button at the bottom (overrides cancelButtonIndex)
boolean
testIDβ
The test id for e2e tests
string
titleβ
If both 'title' and 'message' are not passed will not render the title view at allβ
Title of the action sheet
string
useNativeIOSβ
Should use the native action sheet for iOS
boolean
useSafeAreaβ
In iOS, use safe area, in case component attached to the bottom
boolean
visibleβ
Whether to show the action sheet or not
boolean