Attempted import error: 'react-native-push-notification' does not contain a default export
See original GitHub issueBug
Trying to import PushNotifications but always getting error about missing default export.
Code:
import PushNotification from 'react-native-push-notification';
import NotificationHandler from './NotificationHandler';
export default class NotificationService {
constructor(onRegister, onNotification) {
this.lastId = 0;
this.lastChannelCounter = 0;
this.createDefaultChannels();
NotificationHandler.attachRegister(onRegister);
NotificationHandler.attachNotification(onNotification);
// Clear badge number at start
PushNotification.getApplicationIconBadgeNumber(function (number) {
if (number > 0) {
PushNotification.setApplicationIconBadgeNumber(0);
}
});........
error
Attempted import error: 'react-native-push-notification' does not contain a default export (imported as 'PushNotification').
Issue Analytics
- State:
- Created 3 years ago
- Comments:10
Top Results From Across the Web
Attempted import error/ App' does not contain a default export ...
In Nodejs, to use a variable or a function in another file, you have to export them. And we have two type export....
Read more >Attempted import error: does not contain a default export
Blog : Referencehttps://progvocab.blogspot.com/2020/01/ attempted - import - error - does - not - contain.html.
Read more >Does not contain a default export Error in React.js | bobbyhadz
The "does not contain a default export" error occurs when we try to use a default import to import from a module that...
Read more >attempted import error: 'react-router-dom' does not contain a ...
The problem is what the error says. It's expected that App is default export: import App from " ...
Read more >Notifications - Expo Documentation
Though holding this permission does not have any security implications, it can have ... import * as Notifications from 'expo-notifications'; export default ......
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
no, i just switch to Flutter.
hey @jan-ambroz I had the same error, did you find solution for that?