useBeforeNavBackListener
- Description
- Params and Return
- Example
Hook to catch IOS swipes and Android lower nav back events
Param / Return | Description |
---|---|
param | navigation: navigation object passed to a screencallback: function to execute when 'beforeRemove' is called |
How to use the useBeforeNavBackListener component
useBeforeNavBackListener(navigation, (e) => {
if (imagesList?.length === 0 || filesUploadedSuccess) {
return
}
e.preventDefault()
confirmAlert({
title: t('fileUpload.discard.confirm.title.photos'),
message: t('fileUpload.discard.confirm.message.photos'),
cancelButtonIndex: 0,
destructiveButtonIndex: 1,
buttons: [
{
text: t('fileUpload.continueUpload'),
},
{
text: t('fileUpload.cancelUpload'),
onPress: () => {
navigation.dispatch(e.data.action)
},
},
],
})
})