![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
react-pwa-toolkit
Advanced tools
Most common PWA helpers in one toolkit. Powered by Hooks
Don't hesitate to support the project on Github if you like it ❤️ Also, contributors are always welcome!
The library is made to help to detect what browser your user has and gives you a convenient API to access user behave and most useful device events.
First of all, install it and require the library. This is a React Module.
yarn add react-pwa-toolkit
import React from "react";
import Device, { useNetwork, usePwa, useVisibility, useInstallPrompt } from "react-pwa-toolkit";
Use it inside useEffect.
useEffect(() => {
console.log(Device());
})
It will be something like:
{
"browser": {
"name": "Safari",
"version": "11.0"
},
"os": {
"name": "iOS",
"version": "11.0"
},
"platform": {
"type": "mobile",
"vendor": "Apple",
"model": "iPhone"
},
"engine": {
"name": "WebKit",
"version": "604.1.38"
}
}
If network is available, isOnline will be true. (default: true)
const isOnline = useNetwork(); // true/false
Check user is using PWA or it is a browser.
const isPwa = usePwa(); // true/false
You can track user behave when they move between tabs,
So it is helpful to play a music track when the document becomes visible and pauses the music when the document is no longer visible,
Or even lock the app when they leave it.
const isVisible = useVisibility(); // true/false
Check user choice on add-to-home-screen prompt with installationStatus.
NOTE: If you set it's initial value as false
in useInstallPrompt(false)
, it will show add-to-home-screen popup as soon as possible.
BUT if you want to show a fancy popup to encourage user to install your app set the initial value as true
like useInstallPrompt(true)
then you have access to show the popup whenever you want.
const [installationStatus, installationEvent] = useInstallPrompt(true);
useEffect(() => {
// installationStatus is one of these states: null/dismissed/accepted/installed
if(installationStatus === 'accepted') {
// User accept it. You can save it in some log with device config.
}
// Show Add-to-home-screen prompt, if user have it's condition.
if(installationEvent) {
installationEvent.prompt();
}
})
Licensed as MIT. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.
FAQs
Most common PWA functionality and APIs in one toolkit.
The npm package react-pwa-toolkit receives a total of 2 weekly downloads. As such, react-pwa-toolkit popularity was classified as not popular.
We found that react-pwa-toolkit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.