Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cancelLocalNotification error #729

Closed
Rc85 opened this issue Mar 22, 2021 · 5 comments · Fixed by #754
Closed

cancelLocalNotification error #729

Rc85 opened this issue Mar 22, 2021 · 5 comments · Fixed by #754
Assignees

Comments

@Rc85
Copy link

Rc85 commented Mar 22, 2021

Trying to cancel a local notification. I assume this is to remove the notification from the notification center

        const notificationIds = []
        const notification: Notification = {
          title: `My Takeouts`,
          body: 'You have a new order'
        };

        for (const id of notificationIds) {
          Notifications.cancelLocalNotification(id.toString());
        }

        const notificationId = Notifications.postLocalNotification(notification);

        notificationIds.push(notificationId);

I get a native error

java.lang String cannot be cast to java.lang.Double
@stale
Copy link

stale bot commented Apr 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the 🏚 stale label Apr 21, 2021
@jehee-choi
Copy link

+1

@stale stale bot removed the 🏚 stale label Apr 27, 2021
@douugdev
Copy link

douugdev commented May 17, 2021

I've discovered that the notification id parameter in the function cancelLocalNotification(notificationId) must be a number even though the inferred type by the lib is string.

Notifications.cancelLocalNotification(1); will work while diplaying a linter error and Notifications.cancelLocalNotification('1'); will display no error on your code editor but will give you that native error.

douugdev added a commit to douugdev/react-native-notifications that referenced this issue May 17, 2021
@a-eid
Copy link

a-eid commented May 19, 2021

cancelLocalNotification doesn't work on android

also postLocalNotification fires immediately on android regardless of the fireDate

they have a not about this in the docs.

@stale
Copy link

stale bot commented Jun 18, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants