How to use the @react-native-community/netinfo.isConnectionExpensive function in @react-native-community/netinfo

To help you get started, we’ve selected a few @react-native-community/netinfo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github expo / expo / apps / native-component-list / src / screens / NetInfoScreen.tsx View on Github external
_ensureIsConnectionExpensiveIsUpToDate = () =>
    Platform.OS === 'android' &&
    NetInfo.isConnectionExpensive()
      .then(isConnectionExpensive => this.setState({ isConnectionExpensive }))
      .catch(console.warn)
github react-native-community / react-native-netinfo / example / IsConnectionExpensive.js View on Github external
_checkIfExpensive = () => {
    NetInfo.isConnectionExpensive().then(isConnectionExpensive => {
      this.setState({isConnectionExpensive});
    });
  };
github celo-org / celo-monorepo / packages / mobile / src / utils / LogUploader.ts View on Github external
static async isConnectionWifi(): Promise {
    const connectionInfo = await NetInfo.getConnectionInfo()
    const isConnectionExpensive = await NetInfo.isConnectionExpensive()
    Logger.debug(TAG, `isConnectionWifi/Connection type is ${connectionInfo.type}`)
    Logger.debug(TAG, `isConnectionWifi/is connection expensive: ${isConnectionExpensive}`)
    return connectionInfo.type.toString().toLowerCase() === 'wifi' && !isConnectionExpensive
  }
}