question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

_reactNativePushNotification.default.cancelLocalNotification is not a function

See original GitHub issue

I receive the following error message when I am calling PushNotification.cancelLocalNotification(id):

[TypeError: _reactNativePushNotification.default.cancelLocalNotification is not a function. (In '_reactNativePushNotification.default.cancelLocalNotification(id)', '_reactNativePushNotification.default.cancelLocalNotification' is undefined)]

I am using the following versions: react-native-push-notification: 8.1.0 react-native: 0.65.0

I expect the function to cancel the scheduled push notification with the specific ID. Instead I receive the error message above. I have tested on both an iOS and Android device with the same result. Other PushNotification functions work fine.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:11

github_iconTop GitHub Comments

2reactions
Sliimycommented, Jan 6, 2022

I had the same error, it seems to be an issue with the cache.

I used a previous version with the function cancelLocalNotifications({id:“abc”})

But this method is now deprecated, so I update the package (version 8.1.1) and tried to use cancelLocalNotification(“abc”) It didn’t work in the first time.

It was due to two things.

First one, the native function was not executed. (Even cleaning the cache and uninstalling/reinstalling the app) I had to make some random changement in the file /node_modules/react-native-push-notification/component/index.android.js , save it, start the application with an error, and remove my random changement, start the app. And now the native function was executed. It seems that my application was still using the file from the previous version. The issue #2122 helps me to figure it out.

Second one, the id must be a string of integer, id=“abc” did not work anymore but id=“123” works.

I hope it will help.

1reaction
cyndecommented, Sep 22, 2021

use cancelLocalNotifications({id: 1})

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: _notification.default.localNotification is not a function
I am kinda new in react native and I am trying to implement local push notification in my app and when I try...
Read more >
react-native-push-notification - npm
Start using react-native-push-notification in your project by running ... N and above, this time is not shown anymore by default and must be ......
Read more >
How to use the react-native-push-notification.configure ... - Snyk
How to use the react-native-push-notification.configure function in react-native-push- ... IOS ONLY (optional): default: all - Permissions to register.
Read more >
React Native Integrating Push Notifications with firebase and ...
RNPushNotification” and the default bundle identifier for iOS app will be ... npm install --save react-native-push-notification ...
Read more >
react-native-push-notification-fork: Documentation | Openbase
react-native-push-notification -fork docs, getting started, code examples, ... Manually register module in MainApplication.java (if you did not use ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found