0.0.1 • Published 5 years ago

@rnhooks/network-status v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

@rnhooks/network-status Build Status Maintainability

React Native hook for Network Status

Installation

$ yarn add @rnhooks/network-status

Usage

import useNetworkStatus from '@rnhooks/network-status';

function App() {
  const { type, effectiveType } = useNetworkStatus();

  return (
    <View style={styles.container}>
      <Text style={styles.type}>{`Type: ${type}`}</Text>
      <Text style={styles.effectiveType}>{`Effective Type: ${effectiveType}`}</Text>
    </View>
  );
}

Output

PropDefaultTypeDescription
typenullnone / wifi / cellular / unknownDescribes the type of connection the device is using to communicate with the network
effectiveTypenull2g / 3g / 4g / unknownCross platform values for EffectiveConnectionType