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.

Attempted import error: 'react-native-push-notification' does not contain a default export

See original GitHub issue

Bug

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:open
  • Created 3 years ago
  • Comments:10

github_iconTop GitHub Comments

5reactions
jan-ambrozcommented, Mar 19, 2021

hey @jan-ambroz I had the same error, did you find solution for that?

no, i just switch to Flutter.

0reactions
dreveracommented, Mar 19, 2021

hey @jan-ambroz I had the same error, did you find solution for that?

Read more comments on GitHub >

github_iconTop 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 >

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