rn-internet-connectivity-devjay
v1.0.6
Published
A React Native package to check internet connectivity.
Downloads
4
Maintainers
Readme
React Native Internet Connectivity Checker
A React Native package that allows you to check the internet connectivity of a device.
Installation
- Install the Internet Connectivity Package:
In your React Native project directory, install your package using npm or yarn.
npm install rn-internet-connectivity-devjay
or
yarn add rn-internet-connectivity-devjay
Usage:
- Create a React Native Project:
Start by creating a new React Native project or use an existing one where you want to check internet connectivity.
- Use the Package in Your Code:
Import and use the package in your React Native code.
import { isDeviceConnectedToInternet } from 'rn-internet-connectivity-devjay';
const checkInternet = async () => {
const isConnected = await isDeviceConnectedToInternet();
if (isConnected) {
console.log('Device is connected to the internet');
} else {
console.log('Device is not connected to the internet');
}
};
// Call checkInternet() when needed