invertase / notifee

⚛️ A feature rich notifications library for React Native.
https://notifee.app
Apache License 2.0
1.82k stars 214 forks source link

[Android] Error thrown on undefined `largeIcon` - 7.4.0 #894

Closed shelleysuhling-cb closed 8 months ago

shelleysuhling-cb commented 11 months ago

Hey team! Receiving this error on 7.4.0

notifee.displayNotification(*) 'notification.android.largeIcon' expected a React Native ImageResource value or a valid string URL.

when passing {largeIcon: undefined} to displayNotification.

Defining large icon as undefined is allowed in the AndroidNotification type largeIcon?: string | number | object;, however this error is thrown at runtime. I'm assuming this is a bug on the android native side since not all notifications are assumed to have an icon.

Adjustments have been make on our end to avoid this error, but wanted to raise here in case it hasn't been discovered yet. Thanks!

github-actions[bot] commented 10 months ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

lucasbasquerotto commented 9 months ago

This is an unexpected behaviour, and unfortunately it seems that this issue was closed as not planned.

The good thing is that a workaround is easy to implement. For now I'm deleting the property if not defined:

if (!notification?.android?.largeIcon) {
    delete notification.android?.circularLargeIcon;
    delete notification.android?.largeIcon;
}
mikehardy commented 9 months ago

Still need to audit the "stale" list since the repo was relatively inactive and resuscitate quite a few issues and perhaps PRs, this would make that list of things-to-resuscitate I believe, thanks

github-actions[bot] commented 8 months ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.