useDestructiveAlert
- Description
- Params and Return
- Example
Hook to create appropriate actionSheet for a destructive event TODO: 6269-Combine useDestructiveActionSheet and useShowActionSheet
Param / Return | Description |
---|---|
param | title: optional title of the ActionSheetmessage: optional message for the ActionSheetdestructiveButtonIndex: optional destructive indexcancelButtonIndex: ios cancel indexbuttons: options to show in the ActionSheet |
returns | an action sheet |
How to use the useDestructiveActionSheet component
const deletePhoneAlert = useDestructiveActionSheet()
const onDeletePressed = (): void => {
deletePhoneAlert({
title: t('editPhoneNumber.remove.title', { numberType: buttonTitle }),
message: t('editPhoneNumber.remove.message', { numberType: buttonTitle }),
destructiveButtonIndex: 1,
cancelButtonIndex: 0,
buttons: [
{
text: t('common:cancel'),
},
{
text: t('common:remove'),
onPress: onDelete,
},
],
})
}