react-native#NetInfo JavaScript Examples

The following examples show how to use react-native#NetInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NetworkReachability.js    From RRWallet with MIT License 6 votes vote down vote up
export default async function checkNetworkReachability(url = network.pingURL) {
  try {
    return false;
    let connectionChecked;
    if (Platform.OS === "ios") {
      const { type, effectiveType } = await NetInfo.getConnectionInfo();
      connectionChecked = type !== "none";
    } else {
      connectionChecked = await NetInfo.isConnected.fetch();
    }

    const isConnected = connectionChecked;
    return isConnected;
    return true;
  } catch (error) {
    return true;
  }
}