FilipChalupa / react-use-pwa-install

https://www.npmjs.com/package/react-use-pwa-install
ISC License
4 stars 0 forks source link

Example on CodeSandbox? #2

Open KarlBaumann opened 3 years ago

KarlBaumann commented 3 years ago

Could you maybe create an example on the code sandbox, because I am not able to get the button to work.

KarlBaumann commented 3 years ago

"install" returns null on Chrome desktop on MacOS.

KarlBaumann commented 3 years ago

I would suggest to do something like this

  const { supportsInstall, triggerInstallPrompt } = usePWAInstall()

instead of hiding everything in one variable.

FilipChalupa commented 3 years ago
  1. Do you fulfill PWA requirements set by Chrome? Do you have service worker and webmanifest? https://web.dev/install-criteria/

  2. Do you use supported browser? (Yes, you do.)

  3. Did you already installed the app?

null is returned if the app can't be installed.

KarlBaumann commented 3 years ago

Everything is fine if I click on the icon in the address bar. Only the button does not work. Button works fine on mobile browsers though.

FilipChalupa commented 3 years ago

I see. It happens to me too on another project. I will investigate. I suspect some Apple weirdness. Chrome on Windows works.

FilipChalupa commented 1 year ago

To the original request I've made a demo on Glitch https://glitch.com/edit/#!/react-use-pwa-install-demo.