Incorporated react-native-root-toast into my expo project running on expo 51. Please see the code snippet below for reference:
const toastColors = {
'error': {
color: '#DA5C53',
iconName: <WarningIcon size="5" color="error.800" alignSelf="center" mr="5"/>,
iconColor: "error.800"
},
'success': {
color: '#36AE7C',
iconName: <CheckCircleIcon size="5" color="success.800" alignSelf="center" mr="5"/>,
iconColor: "success.800"
},
'info': {
color: '#4D96FF',
iconName: <InfoIcon size="5" color="info.800" alignSelf="center" mr="5"/>,
iconColor: "info.800"
}
}
export function ShowToast({
id,
status,
title,
description
}: toastType){
if(description == undefined){
description = "An error occurred";
}
console.log(description, "description")
let toast = Toast.show("An error occurred", {
duration: Toast.durations.LONG,
position: Toast.positions.BOTTOM,
backgroundColor: toastColors[status].color ,
delay: 2000,
hideOnPress: true,
opacity: 1,
shadow: true,
animation: true,
})
setTimeout(() => {
Toast.hide(toast);
}, 5000)
}
I have tried different toast options but none seem to work. Can someone assist me in resolving this issue?