_reactNativePushNotification.default.cancelLocalNotification is not a function
See original GitHub issueI 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:
- Created 2 years ago
- Reactions:3
- Comments:11
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
use cancelLocalNotifications({id: 1})