Closed gabyrusu closed 4 years ago
Can you try named import like below.
import * as ReactNotification from 'react-web-notification'
@georgeOsdDev I'm using Typescript so I imported from typings like here https://github.com/mobilusoss/react-web-notification/issues/38 But that's not the problem as on desktop they work just fine. The problem is on android devices (as tested so far) because the "new Notification()" constructor is not implemented and might be removed in the future for desktops as well. See https://bugs.chromium.org/p/chromium/issues/detail?id=481856#c3
You can use props.swRegistration
.
It will not call new Notification()
.
Oh, how did I missed that? Thanks!
After allowing notifications on android browsers, the app is crashing because of this error:
react-dom.production.min.js:209 TypeError: Failed to construct 'Notification': Illegal constructor. Use ServiceWorkerRegistration.showNotification() instead.
It seems like this is related to android not supporting the "new Notification()" constructor https://bugs.chromium.org/p/chromium/issues/detail?id=481856