Skip to content

Commit

Permalink
Fixed: issue of undefined when options are not passed in toast(#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
ymaheshwari1 committed Sep 26, 2023
1 parent c7c367b commit 78bf008
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ const showToast = async (message: string, options?: any) => {
...options
} as any;

if (!options.position) {
if (!options?.position) {
config.position = 'bottom';
}
if (options.canDismiss) {
if (options?.canDismiss) {
config.buttons = [
{
text: translate('Dismiss'),
role: 'cancel',
},
]
}
if (!options.manualDismiss) {
if (!options?.manualDismiss) {
config.duration = 3000;
}

const toast = await toastController.create(config)
// present toast if manual dismiss is not needed
return !options.manualDismiss ? toast.present() : toast
return !options?.manualDismiss ? toast.present() : toast
}

const handleDateTimeInput = (dateTimeValue: any) => {
Expand Down

0 comments on commit 78bf008

Please sign in to comment.