evaluating RNPushNotification.getInitialNotification is not an object
See original GitHub issueHi all,
I have installed React native push Notification and following the installation guide correctly but I faced this error: TypeError: null is not an object (evaluating 'RNPushNotification.getInitialNotification ').
import PushNotification from “react-native-push-notification”; import PushNotificationIOS from “@react-native-community/push-notification-ios”; import {Platform} from “react-native”; NotifService.js:
export default class NotifService {
configure = () => {
PushNotification.configure({
// (optional) Called when Token is generated (iOS and Android)
onRegister: function(token){
console.log("[Notification Service] on register token:", token);
},
// (required) Called when a remote or local notification is opened or received
onNotification: (notification) => {
console.log("[Notification Service] onNotification:", notification);
// process the notification
// required on iOS only (see fetchCompletionHandler docs: https://github.com/react-native-community/react-native-push-notification-ios)
notification.finish(PushNotificationIOS.FetchResult.NoData);
},
senderID: "----",
permissions: {
alert: true,
badge: true,
sound: true,
},
popInitialNotification: true,
requestPermissions: true,
});
}
}
MyComponent.js:
componentDidMount() {
this.localNotif = new NotifService();
this.localNotif.configure();
}
Any help/Ideas please?!
Issue Analytics
- State:
- Created 4 years ago
- Comments:29
Top Results From Across the Web
react-native-push-notification is undefined - Stack Overflow
Its all working on iOS but on android I get undefined is not an object(evaluating RNPushnotification.getInitialNotifications).
Read more >cljsrn 2022-01-29 - Slack Archive
Could not evaluate form: (function (){try{return ... [TypeError: null is not an object (evaluating 'RNPushNotification.
Read more >Discussion of React Native Push Notifications
getInitialNotification() , in order to get the initial notification on iOS. ... typeError null:null is not an object evaluating.this.
Read more >react-native-push-notification - npm
If you do, notification handlers will not fire, because they are not loaded. ... Notification object example: ... RNPushNotification.
Read more >PushNotificationIOS - React Native
getInitialNotification() ... PushNotificationIOS.getInitialNotification();. This method returns a promise. If the app was launched by a push ...
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 FreeTop 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
Top GitHub Comments
I solved my issue
npm install react-native-push-notification --save
Yeah tried that too !
Edit : I reset the cache and deleted the build folder and now the error is gone but I am not getting the notification 😐
Edit 2. : I forgot to create a channel and after reading the changelog I did it properly and now it works perfectly and fine !
The possible fix for this issue is
reset the cache and delete the build folder and now the error will be gone