Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@react-native-community/netinfo

React Native Network Info API for iOS & Android

react-native, react native, netinfo, networking, network info

readme

@react-native-community/netinfo

Actions Supports Android, iOS, macOS, Windows and Web MIT License Lean Core Extracted

React Native Network Info API for Android, iOS, macOS, Windows & Web. It allows you to get information on:

  • Connection type
  • Connection quality

Getting started

Install the library using either Yarn:

yarn add @react-native-community/netinfo

or npm:

npm install --save @react-native-community/netinfo

Using React Native >= 0.60

Linking the package manually is not required anymore with Autolinking.

  • iOS Platform:

    $ npx pod-install # CocoaPods on iOS needs this extra step

  • Android Platform with AndroidX:

    Modify your android/build.gradle configuration:

    buildscript {
      ext {
        buildToolsVersion = "xx.yy.zz"
        minSdkVersion = xyz
        compileSdkVersion = xyz
        targetSdkVersion = xyz
      }
  • macOS Platform:

    Autolinking is not yet available on macOS. See the Manual linking steps for macOS below.

<summary>Manually link the library on macOS</summary>
  1. Open your project .xcodeproj on xcode.

  2. Right click on the Libraries folder and select Add files to "yourProjectName".

  3. Add RNCNetInfo.xcodeproj (located at node_modules/@react-native-community/react-native-netinfo/macos) to your project Libraries.

  4. Go to Build Phases -> Link Binary with Libraries and add: libRNCNetInfo-macOS.a.

  • Windows Platform:

    Autolinking automatically works on RNW >= 0.63.

Minimum supported versions for windows

  • react-native-windows 0.63 or newer
  • MSVC build tools v142 (included in Visual Studio 2019) or newer
  • x86, x64, or arm64 are supported, arm (32-bit) is not supported

React Native Compatibility

To use this library you need to ensure you are using the correct version of React Native. We support react-native 0.60+ with auto-linking.

If you are using a version of React Native that is lower than 0.60 check older versions of this README for details, but no support will be provided.

Browser Compatilibity

The web implementation heavily depends on the Network Information API which is still an is an experimental technology and thus it's not supported in every browser. If this API is not available the library will safely fallback to the old onLine property and return basic connection information.

AbortController is used to cancel network requests, and may not be available on Internet Explorer, though it is available on Edge https://caniuse.com/abortcontroller

Node Compatibility

Node v16 is the minimum required node version - AbortController is only present in stable versions of node from v16 on

Migrating from the core react-native module

This module was created when the NetInfo was split out from the core of React Native. To migrate to this module you need to follow the installation instructions above and then change your imports from:

import { NetInfo } from "react-native";

to:

import NetInfo from "@react-native-community/netinfo";

Note that the API was updated after it was extracted from NetInfo to support some new features, however, the previous API is still available and works with no updates to your code.

Usage

Global vs isolated instance

Internally this library has a network state manager class to handle all the functionality and state. This library provides two options for instantiating the class:

  1. you can use global library functions which taps into a global singleton instance of the class
  2. or you can create isolated instances of the class to tap into, each being separately configured

Global instance functions:

Subscribe to network state updates:

import { addEventListener } from "@react-native-community/netinfo";

// Subscribe
const unsubscribe = addEventListener(state => {
  console.log("Connection type", state.type);
  console.log("Is connected?", state.isConnected);
});

// Unsubscribe
unsubscribe();

Get the network state once:

import { fetch } from "@react-native-community/netinfo";

fetch().then(state => {
  console.log("Connection type", state.type);
  console.log("Is connected?", state.isConnected);
});

Get network state updates from the global instance via a react hook:

import { useNetInfo } from "@react-native-community/netinfo";

const { type, isConnected } = useNetInfo();

Isolated instance:

Use an isolated instance of the network manager:

import { useNetInfoInstance } from "@react-native-community/netinfo";

const { netInfo: { type, isConnected }, refresh } = useNetInfoInstance();

API

Types

NetInfoState

Describes the current state of the network. It is an object with these properties:

Property Type Description
type NetInfoStateType The type of the current connection.
isConnected boolean, null If there is an active network connection. Defaults to null on most platforms for unknown networks. Note: Web browsers report network type unknown for many otherwise valid networks (https://caniuse.com/netinfo), so isConnected may be true or false and represent a real connection status even for unknown network types in certain cases.
isInternetReachable boolean, null If the internet is reachable with the currently active network connection. If unknown defaults to null
isWifiEnabled boolean (Android only) Whether the device's WiFi is ON or OFF.
details | The value depends on the type value. See below.

The details value depends on the type value.

type is none or unknown

details is null.

type is wifi

details has these properties:

Property Platform Type Description
isConnectionExpensive Android, iOS, macOS, Windows, Web boolean If the network connection is considered "expensive". This could be in either energy or monetary terms.
ssid Android, iOS (not tvOS), Windows string The SSID of the network. May not be present, null, or an empty string if it cannot be determined. On iOS, your app must meet at least one of the following requirements and you must set the shouldFetchWiFiSSID configuration option or no attempt will be made to fetch the SSID. On Android, you need to have the ACCESS_FINE_LOCATION permission in your AndroidManifest.xml and accepted by the user.
bssid Android, iOS (not tvOS), Windows* string The BSSID of the network. May not be present, null, or an empty string if it cannot be determined. On iOS, make sure your app meets at least one of the following requirements. On Android, you need to have the ACCESS_FINE_LOCATION permission in your AndroidManifest.xml and accepted by the user.
strength Android, Windows number An integer number from 0 to 100 for the signal strength. May not be present if the signal strength cannot be determined.
ipAddress Android, iOS, macOS, Windows string The external IP address. Can be in IPv4 or IPv6 format. May not be present if it cannot be determined.
subnet Android, iOS, macOS string The subnet mask in IPv4 format. May not be present if it cannot be determined.
frequency Android, Windows* number Network frequency. Example: For 2.4 GHz networks, the method will return 2457. May not be present if it cannot be determined.
linkSpeed Android number The link speed in Mbps.
rxLinkSpeed Android number The current receive link speed in Mbps. (Android Q / API level 29 and above)
txLinkSpeed Android number The current transmit link speed in Mbps. (Android Q / API level 29 and above)

* Requires wiFiControl capability in appxmanifest. Without it, these values will be null.

type is cellular

details has these properties:

Property Platform Type Description
isConnectionExpensive Android, iOS, macOS, Windows, Web boolean If the network connection is considered "expensive". This could be in either energy or monetary terms.
cellularGeneration Android, iOS, Windows NetInfoCellularGeneration The generation of the cell network the user is connected to. This can give an indication of speed, but no guarantees.
carrier Android, iOS string The network carrier name. May not be present or may be empty if none can be determined.
type is bluetooth, ethernet, wimax, vpn, or other

details has these properties:

Property Type Description
isConnectionExpensive boolean If the network connection is considered "expensive". This could be in either energy or monetary terms.

NetInfoStateType

Describes the current type of network connection. It is an enum with these possible values:

Value Platform Description
none Android, iOS, macOS, Windows, Web No network connection is active
unknown Android, iOS, macOS, Windows, Web The network state could not or has yet to be be determined
cellular Android, iOS, Windows, Web Active network over cellular
wifi Android, iOS, macOS, Windows, Web Active network over Wifi
bluetooth Android, Web Active network over Bluetooth
ethernet Android, macOS, Windows, Web Active network over wired ethernet
wimax Android, Web Active network over WiMax
vpn Android Active network over VPN
other Android, iOS, macOS, Windows, Web Active network over another type of network

NetInfoCellularGeneration

Describes the current generation of the cellular connection. It is an enum with these possible values:

Value Description
null Either we are not currently connected to a cellular network or type could not be determined
2g Currently connected to a 2G cellular network. Includes CDMA, EDGE, GPRS, and IDEN type connections
3g Currently connected to a 3G cellular network. Includes EHRPD, EVDO, HSPA, HSUPA, HSDPA, and UTMS type connections
4g Currently connected to a 4G cellular network. Includes HSPAP and LTE type connections
5g Currently connected to a 5G cellular network. Includes NRNSA (iOS only) and NR type connections

NetInfoConfiguration

The configuration options for the library.

Property Type Default Description
reachabilityUrl string https://clients3.google.com/generate_204 The URL to call to test if the internet is reachable. Only used on platforms which do not supply internet reachability natively or if useNativeReachability is false.
reachabilityHeaders object {} A HTTP headers object, an object literal, or an array of two-item arrays to set request's headers, to use during the reachabilityUrl URL call to test if the internet is reachable. Defaults to {}.
reachabilityMethod NetInfoMethodType HEAD The HTTP request method to use to call reachabilityUrl URL to call to test if the internet is reachable. Defaults to HEAD. GET is also available
reachabilityTest (response: Response) => boolean Promise.resolve(response.status === 204) A function which is passed the Response from calling the reachability URL. It should return true if the response indicates that the internet is reachable. Only used on platforms which do not supply internet reachability natively or if useNativeReachability is false.
reachabilityShortTimeout number 5 seconds The number of milliseconds between internet reachability checks when the internet was not previously detected. Only used on platforms which do not supply internet reachability natively or if useNativeReachability is false.
reachabilityLongTimeout number 60 seconds The number of milliseconds between internet reachability checks when the internet was previously detected. Only used on platforms which do not supply internet reachability natively or if useNativeReachability is false.
reachabilityRequestTimeout number 15 seconds The number of milliseconds that a reachability check is allowed to take before failing. Only used on platforms which do not supply internet reachability natively or if useNativeReachability is false.
reachabilityShouldRun () => boolean () => true A function which returns a boolean to determine if checkInternetReachability should be run.
shouldFetchWiFiSSID boolean false A flag indicating one of the requirements on iOS has been met to retrieve the network (B)SSID, and the native SSID retrieval APIs should be called. This has no effect on Android.
useNativeReachability boolean true A flag indicating whether or not Netinfo should use native reachability checks, if available.

Global instance methods

Please note the difference between global and isolated usage described here

configure()

Configures the library with the given configuration. You only need to supply the properties which you want to change from the default values.

Note that calling this will stop all previously added listeners from being called again. It is best to call this right when your application is started to avoid issues.

Example:

NetInfo.configure({
  reachabilityUrl: 'https://clients3.google.com/generate_204',
  reachabilityTest: async (response) => response.status === 204,
  reachabilityLongTimeout: 60 * 1000, // 60s
  reachabilityShortTimeout: 5 * 1000, // 5s
  reachabilityRequestTimeout: 15 * 1000, // 15s
  reachabilityShouldRun: () => true,
  shouldFetchWiFiSSID: true, // met iOS requirements to get SSID. Will leak memory if set to true without meeting requirements.
  useNativeReachability: false
});

addEventListener()

Subscribe to connection information. The callback is called with a parameter of type NetInfoState whenever the connection state changes. Your listener will be called with the latest information soon after you subscribe and then with any subsequent changes afterwards. You should not assume that the listener is called in the same way across devices or platforms.

Parameter Type Description
listener (state:NetInfoState)=> void The listener which will be called whenever the connection state changes

Example:

// Subscribe
const unsubscribe = NetInfo.addEventListener(state => {
  console.log("Connection type", state.type);
  console.log("Is connected?", state.isConnected);
});

// Unsubscribe
unsubscribe();

useNetInfo()

A React Hook which can be used to get access to the latest state from the global instance. It returns a hook with the NetInfoState type.

Example:

import {useNetInfo} from "@react-native-community/netinfo";

const YourComponent = () => {
  const netInfo = useNetInfo();

  return (
    <View>
      <Text>Type: {netInfo.type}</Text>
      <Text>Is Connected? {netInfo.isConnected?.toString()}</Text>
    </View>
  );
};

You can optionally send configuration when setting up the hook. Note that configuration is global for the library, so you shouldn't send different configuration for different hooks. It is instead recommended that you called NetInfo.configure() once when your project starts. The hook option is only provided as a convinience.

const YourComponent = () => {
  const netInfo = useNetInfo({
    reachabilityUrl: 'https://clients3.google.com/generate_204',
    reachabilityTest: async (response) => response.status === 204,
    reachabilityLongTimeout: 60 * 1000, // 60s
    reachabilityShortTimeout: 5 * 1000, // 5s
    reachabilityRequestTimeout: 15 * 1000, // 15s
    reachabilityShouldRun: () => true,
    shouldFetchWiFiSSID: true, // met iOS requirements to get SSID
    useNativeReachability: false
  });

  // ...
};

fetch()

Returns a Promise that resolves to a NetInfoState object.

Example:

NetInfo.fetch().then(state => {
  console.log("Connection type", state.type);
  console.log("Is connected?", state.isConnected);
});

You can optionally send an interface string so the Promise resolves to a NetInfoState from the NetInfoStateType indicated in interface argument.

NetInfo.fetch("wifi").then(state => {
  console.log("SSID", state.details.ssid);
  console.log("BSSID", state.details.bssid);
  console.log("Is connected?", state.isConnected);
});

refresh()

Updates NetInfo's internal state, then returns a Promise that resolves to a NetInfoState object. This is similar to fetch(), but really only useful on platforms that do not supply internet reachability natively. For example, you can use it to immediately re-run an internet reachability test if a network request fails unexpectedly.

Example:

NetInfo.refresh().then(state => {
    console.log("Connection type", state.type);
    console.log("Is connected?", state.isConnected);
});

This will also update subscribers using addEventListener and/or useNetInfo.

Isolated instance

Please note the difference between global and isolated usage described here

useNetInfoInstance()

A React Hook which can be used to create and manage an isolated instance of a network manager class. It returns a refresh function and the current NetInfoState.

Example:

import { useNetInfoInstance } from "@react-native-community/netinfo";

const YourComponent = () => {
  const {netInfo, refresh} = useNetInfoInstance();

  return (
    <View>
      <Text>Type: {netInfo.type}</Text>
      <Text>Is Connected? {netInfo.isConnected?.toString()}</Text>
    </View>
  );
};

isPaused: You can also pause the hooks internal network checks by passing a boolean value true as the first argument.

configuration: You can optionally send configuration as the second argument when setting up the hook. Note that configuration is local to the instance managed by this hook and has no relation to the configuration passed to other functions configure() or useNetInfo();

import { useNetInfoInstance } from "@react-native-community/netinfo";

const YourComponent = () => {
  const isPaused = false;
  const config = {
    reachabilityUrl: 'https://clients3.google.com/generate_204',
    reachabilityTest: async (response) => response.status === 204,
    reachabilityLongTimeout: 60 * 1000, // 60s
    reachabilityShortTimeout: 5 * 1000, // 5s
    reachabilityRequestTimeout: 15 * 1000, // 15s
    reachabilityShouldRun: () => true,
    shouldFetchWiFiSSID: true, // met iOS requirements to get SSID
    useNativeReachability: false
  }

  const { netInfo } = useNetInfoInstance(isPaused, config);
  //...

Troubleshooting

Errors when building on Android

Errors while running Jest tests

If you do not have a Jest Setup file configured, you should add the following to your Jest settings and create the jest.setup.js file in project root:

setupFiles: ['<rootDir>/jest.setup.js']

You should then add the following to your Jest setup file to mock the NetInfo Native Module:

import mockRNCNetInfo from '@react-native-community/netinfo/jest/netinfo-mock.js';

jest.mock('@react-native-community/netinfo', () => mockRNCNetInfo);

Issues with the iOS simulator

There is a known issue with the iOS Simulator which causes it to not receive network change notifications correctly when the host machine disconnects and then connects to Wifi. If you are having issues with iOS then please test on an actual device before reporting any bugs.

Switching between different Wi-Fi does not send events in iOS

The SCNetworkReachability API used in iOS does not send events to the app in the background, so switching from one Wi-Fi network to another when your App was in background will not send an event and your network state will be out of sync with device state. To be sure you have up to date status when your app is in foreground again, you should re-fetch state each time when App comes to foreground, something like this:

  useEffect(() => {
    const subAppState = AppState.addEventListener("change", async (nextAppState) => {
      if (IS_IOS_DEVICE && nextAppState=='active') {
        let newNetInfo = await NativeModules.RNCNetInfo.getCurrentState('wifi');
        //your code here 
      }
    });
    const unsubNetState = NetInfo.addEventListener(state => {
        //your code here
    });
    return () => {
        if (subAppState) {
            subAppState.remove();
        }
        unsubNetState();
    };
  },[]);

Maintainers

Maintainers Emeritus

Contributing

Please see the contributing guide.

License

The library is released under the MIT license. For more information see LICENSE.

changelog

11.4.1 (2024-09-20)

Bug Fixes

  • ensure one reachability check in-flight at once / proper useEffect listener cleanup (#732) (eaed080)

11.4.0 (2024-09-12)

Features

  • android: use node resolver to find react native package in monorepos (#735) (ef79980)

11.3.3 (2024-09-12)

Bug Fixes

  • android: add invalidate method for rn74+, onCatalystInstanceDestroy delegates (#737) (538623e)

11.3.2 (2024-05-11)

Bug Fixes

  • types: isConnected / isInternetReachable should be boolean not true (#721) (6e2c422)

11.3.1 (2024-02-27)

Bug Fixes

  • update nativeInterface default export to support bridgeless mode (#717) (950410b)

11.3.0 (2024-02-14)

Features

11.2.1 (2023-12-12)

Bug Fixes

  • update internetReachability fetch abort (#706) (d44d5a8)

11.2.0 (2023-12-05)

Features

  • web: add support for Tizen and WebOS (#703) (030887e)

11.1.1 (2023-11-29)

Bug Fixes

  • internetReachability aborts handle cancel correctly (#700) (0a36296)

11.1.0 (2023-11-08)

Features

  • add useNetInfoInstance - a non singleton-state hook to manage configs / events independently (#687) (ca4c586)

11.0.1 (2023-11-07)

Bug Fixes

  • types: fix type error on new headers feature (#694) (270be4f)

11.0.0 (2023-11-04)

  • feat(android)!: specify export mode on BroadcastReceivers, requires compileSdk 33+ (#692) (a5864cc), closes #692

BREAKING CHANGES

    • compileSdk minimum is now 33
  • windows SDK minimum bumped to 10.0.17763.0 for current react-native-windows

10.0.0 (2023-11-01)

BREAKING CHANGES

  • netinfo now requires AbortController, node v16 / edge required it will likely not work on internet explorer from this version onwards

9.5.0 (2023-11-01)

Features

  • add optional reachabilityHeaders param to NetInfoConfiguration (#673) (0cbf067)

9.4.2 (2023-11-01)

Bug Fixes

  • types: add optional isWifiEnabled boolean to NetInfoUnknownState + NetInfoDisconnectedState (#680) (46c4c71)

9.4.1 (2023-06-29)

Bug Fixes

  • android: making rn >= 73 support also compatible with rn <= 66 (#676) (0c053eb)

9.4.0 (2023-06-29)

Features

  • android: add support for React Native 0.73 (#675) (224fdbb)

9.3.11 (2023-06-29)

Bug Fixes

9.3.10 (2023-05-05)

Bug Fixes

  • web: verify window exists before attempting to access navigator (#666) (60b99f2)

9.3.9 (2023-04-06)

Bug Fixes

  • android: avoid crash on devices without wifi (#662) (a519e59)

9.3.8 (2023-03-29)

Bug Fixes

  • windows: fix crash in GetCellularGeneration for some LTE network adapters (#660) (7e1c7fb)

9.3.7 (2022-11-28)

Bug Fixes

  • web: check window is defined before accessing (#646) (ba5c22c)

9.3.6 (2022-10-26)

Bug Fixes

  • android: return netmask of first IPv4 address (#634) (f740f45), closes #633

9.3.5 (2022-10-15)

Bug Fixes

  • windows: fix crash in getIpAddressSync (#631) (cc3ed0f)

9.3.4 (2022-10-05)

Bug Fixes

  • notify subscriptions after state changes (#630) (67c88be)

9.3.3 (2022-10-02)

Bug Fixes

  • macCatalyst: add compilation conditionals for macCatalyst (#629) (8e4cace)

9.3.2 (2022-09-25)

Bug Fixes

  • android, vpn: ensure downlink >= 0 for internetReachable to be true on vpn (#624) (20c2cd2)

9.3.1 (2022-09-18)

Bug Fixes

  • tests, mock: allow mocking netinfostate type for testing (#619) (956bceb)

9.3.0 (2022-06-28)

Features

  • add linkSpeed, rxLinkSpeed, txLinkSpeed info to wifi on android (#605) (8cad8b7), closes #604

9.2.0 (2022-06-28)

Features

  • add support for reachabilityMethod to specify GET or HEAD (#610) (3f5badd)

9.1.0 (2022-06-24)

Features

  • add parameter useNativeReachability to optionally choose non-native reachability test (#609) (9b02cac)

9.0.0 (2022-06-03)

  • fix(windows)!: change WindowsTargetPlatformVersion to 10.0 / drop arm32 / drop rnw < 0.63 (#603) (16d6568), closes #603

BREAKING CHANGES

  • needs react-native-windows 0.63+ and MSVC build tools v142+ (Visual Studio 2019+), drop arm32

8.3.1 (2022-05-30)

Bug Fixes

  • web: removeListeners should actually remove listeners (#600) (60e9e38)

8.3.0 (2022-04-22)

Features

8.2.0 (2022-03-18)

Features

8.1.0 (2022-03-02)

Features

  • windows, ip-address: add ipAddress info to windows details (#581) (11f3e3b)

8.0.0 (2022-02-10)

  • fix(CHANGELOG)!: note that v7.1.12 is breaking if you have wifi SSID permission (#574) (99072e0), closes #574

BREAKING CHANGES

  • it's possible this is a breaking change, depending on your app use case. If you relied on iOS SSID information and met Apple's strict criteria for accessing SSID, you need to set the new config value shouldFetchWiFiSSID to true. If you set it to true and do not meet the criteria your app may crash due to a memory leak. All versions prior to 7.1.12 would attempt to fetch the information regardless of permission, leak memory, and possibly crash. This change avoids that crash.

7.1.12 (2022-02-09)

BREAKING CHANGE NOTICE - it's possible this is a breaking change, depending on your app use case. If you relied on iOS SSID information and met Apple's strict criteria for accessing SSID, you need to set the new config value shouldFetchWiFiSSID to true. If you set it to true and do not meet the criteria your app may crash due to a memory leak. All versions prior to 7.1.12 would attempt to fetch the information regardless of permission, leak memory, and possible crash. This change avoids that crash.

Bug Fixes

  • ios: avoid memory leak from ssid APIs by adding explicit config (#560) (fbf7c15), closes #420

7.1.11 (2022-02-08)

Bug Fixes

  • windows: fix race condition in WiFi connection details feature (#568) (0cd8132)

7.1.10 (2022-02-07)

Bug Fixes

  • android: use registerDefaultNetworkCallback so toggling airplane mode works (#571) (e8af2de)

7.1.9 (2022-01-26)

Bug Fixes

  • android: count native listeners / correctly disable listener if count == 0 (#569) (5ae16f6)

7.1.8 (2022-01-25)

Bug Fixes

  • windows: refactor implementation to avoid crashes (#564) (cc4bfa3)

7.1.7 (2021-12-20)

Bug Fixes

  • android: populate network value during initial module startup (#553) (c05080f)

7.1.6 (2021-12-13)

Bug Fixes

  • android: avoid send event when has no listener (#548) (cad47d8)

7.1.5 (2021-12-09)

Bug Fixes

  • android: use method-local ref to instance var for multi-thread safety #549 (#550) (81bbc87)

7.1.4 (2021-12-07)

Bug Fixes

  • android: try async state fetch as stale state workaround (#547) (937cf48), closes #542

7.1.3 (2021-11-29)

Bug Fixes

  • web, isConnected: Return actual connection state even if network type is 'unknown' (#544) (36d6dc9)

7.1.2 (2021-11-17)

Bug Fixes

  • jest, mock: addEventListener returns a function to match API (#529) (82ca2ad)

7.1.1 (2021-11-17)

Bug Fixes

  • ios, 5g: do not use 5g symbols until iOS14.1 (#525) (932cd83)

7.1.0 (2021-11-17)

Features

  • android, native: make native API public for mixed-native use (#524) (96b8d2f)

7.0.0 (2021-11-16)

  • fix(windows)!: Fix autolinking and remove legacy projects (#521) (45628d8), closes #521

BREAKING CHANGES

  • Drop support for react-native-windows 0.61 and lower. Update to RNW 0.62 or higher

6.2.1 (2021-11-15)

Bug Fixes

  • android: fix for outdated network states (#510) (d5f06ba)

6.2.0 (2021-11-13)

Features

6.1.1 (2021-11-13)

Bug Fixes

  • android: declare java 1.8 feature usage so assembleInstrumentedTest builds work (#466) (48d4364)

6.1.0 (2021-11-07)

Features

  • reachability test may be enabled/disabled via user-supplied function (#513) (83c1e0d)

6.0.6 (2021-11-04)

Bug Fixes

  • windows, crash: try/catch fetching network profile, new windows example app (#511) (ef3ac76), closes #454

6.0.5 (2021-11-03)

Bug Fixes

  • jest: mock return value not resolve value for useNetInfo mock (#515) (cfde0aa)

6.0.4 (2021-10-22)

Bug Fixes

  • android: use ConnectivityManager directly, drop androidx dependency (#509) (2569f56)

6.0.3 (2021-10-22)

Bug Fixes

  • android, jcenter: remove jcenter dependency / update example (#500) (94c5398)

6.0.2 (2021-09-03)

Bug Fixes

  • ios: remove iOS listener stubs added for RN0.65 compat, they caused a regression (#493) (a52b0a5)

6.0.1 (2021-08-24)

Bug Fixes

6.0.0 (2021-02-19)

feature

BREAKING CHANGES

  • useNetinfo: When the connection state is unknown, the isConnected and isInternetReachable properties are now set to null rather than false. This allow you to easily detect the initial "unknown" state before the state is detected and set to a boolean.

5.9.10 (2021-01-06)

Bug Fixes

  • ios,tvos: Remove IPv4-only paths to prevent App Store warnings (#431 by @ greenantdotcom ) (1db98cb)

5.9.9 (2020-11-23)

Bug Fixes

5.9.8 (2020-11-23)

Bug Fixes

5.9.7 (2020-09-18)

Bug Fixes

  • ios: depend directly on React-Core in podspec for Xcode 12 compatibility (#409) (bcf8bf9)

5.9.6 (2020-08-10)

Bug Fixes

  • android: Add missing isWifiEnabled type definition (#396 by @TimRobinson1) (76d8db5)

5.9.5 (2020-07-16)

Bug Fixes

5.9.4 (2020-06-25)

Bug Fixes

  • android: Add another check in ConnectivityReciever to make sure we have ACCESS_WIFI_STATE permission (#379 by @sweggersen) (b0ff1ff)

5.9.3 (2020-06-19)

Bug Fixes

  • added strength wifi property to typescript (#377) (e8cb4d3)

5.9.2 (2020-05-26)

Bug Fixes

  • Android: Do not use getFrequency method for Android lower than LOLLIPOP (#367 by @ObidosDev) (4957aaa)

5.9.1 (2020-05-24)

Bug Fixes

  • macOS: Ensure Cocoapods installation works on macOS (#366 by @Simek) (c8b280c)

5.9.0 (2020-05-18)

Features

5.8.1 (2020-05-11)

Bug Fixes

  • android: Avoid unneccesary downoads of Gradle plugins (#358 by @SaeedZhiany) (8479319)

5.8.0 (2020-04-22)

Features

  • windows: Add C++/WinRT Implementation to support the latest react-native-windows (#349 by @kaiguo) (18e2f20)

5.7.1 (2020-04-14)

Bug Fixes

  • Fix the provided Jest mock so it works with the instructions in the README (a24ebb1), closes #345 #327

5.7.0 (2020-03-30)

Bug Fixes

Features

5.6.2 (2020-03-11)

Bug Fixes

5.6.1 (2020-03-10)

Bug Fixes

  • Ensure the default timeouts are the correct way around (4e3e981)

5.6.0 (2020-03-10)

Features

5.5.1 (2020-02-23)

Bug Fixes

5.5.0 (2020-02-12)

Features

5.4.0 (2020-02-12)

Features

5.3.4 (2020-02-12)

Bug Fixes

5.3.3 (2020-01-15)

Bug Fixes

  • android: Handle invalid networks in network listener (#286) (a153240)

5.3.2 (2020-01-06)

Bug Fixes

  • tvOS: Fixed a crash with tvOS builds caused by trying to use the ssid method (#283 by @vdmtrv) (a0191e0)

5.3.1 (2020-01-04)

Bug Fixes

  • android: Remove the Android native tests to avoid issues (d9fdf85), closes #276

5.3.0 (2020-01-04)

Features

  • Export a mock to make Jest testing easier (#275 by @Naturalclar) (68bba0a)

5.2.0 (2019-12-29)

Features

  • Allow fetching details for a specific network interface (#256 by @Rapsssito) (05e5fb7)

5.1.0 (2019-12-29)

Features

5.0.2 (2019-12-29)

Bug Fixes

  • android: Fixed connection change bug on Android (#265 by @QuickBase) (8748242)

5.0.1 (2019-12-20)

Bug Fixes

5.0.0 (2019-12-08)

Features

  • Configuration & removal of deprecated methods (#230) (fab577d)

BREAKING CHANGES

  • Previously deprecated methods have been removed. These methods have been deprecated since this library was extracted from the core of React Native. Most users will not have any issues with migrating if they were not ignoring the previous warnings.

Added a new way to configure the reachability URL that the library uses on iOS to check for an internet connection. The default is still to use the Google Chrome URL, however, you can now customise this URL, test function, and the timeouts that are used.

4.7.0 (2019-12-08)

Bug Fixes

Features

4.6.2 (2019-12-08)

Bug Fixes

4.6.1 (2019-11-17)

Bug Fixes

  • Remove Android Spotless formatter to avoid issues with resolving plugins (1c2de77), closes #243 #213

4.6.0 (2019-11-03)

Features

4.5.0 (2019-11-03)

Features

4.4.0 (2019-10-06)

Features

  • iOS: Detect Apple TV wired connection and retrieve the Wifi IP address & subnet (#229 by @gcesarmza) (2d2d167)

4.3.3 (2019-10-04)

Bug Fixes

4.3.2 (2019-10-04)

Bug Fixes

  • iOS: Method definition for 'dictionaryValue' not found (#224) (a5f227c)

4.3.1 (2019-10-03)

Bug Fixes

  • iOS: Crash caused by trace condition when releasing resources (#209 by @tido64) (b43838f)

4.3.0 (2019-09-30)

Features

  • Added 'subnet' to wifi details (#205 by @Rapsssito) (2912a76)

4.2.2 (2019-09-19)

Bug Fixes

  • Android: Add gradle backward-compatibility with AndroidX (#192) (6514f0b)

4.2.1 (2019-09-07)

Bug Fixes

  • tvOS: Do not import CoreTelephony on tvOS (#195) (3fe3c6f)

4.2.0 (2019-09-03)

Features

4.1.5 (2019-08-17)

Bug Fixes

  • Do not include examples in the NPM package (#179) (c8c26cc)

4.1.4 (2019-08-06)

Bug Fixes

4.1.3 (2019-07-21)

Bug Fixes

4.1.2 (2019-07-19)

Bug Fixes

4.1.1 (2019-07-15)

Bug Fixes

4.1.0 (2019-07-13)

Features

4.0.0 (2019-07-06)

Features

BREAKING CHANGES

  • android: You are required to only use either the Support Library or AndroidX for your dependencies. If you need to migrate this library back to the support library, or another library forward to AndroidX, then take a look at the Jetifier tool.

3.2.1 (2019-06-01)

Bug Fixes

3.2.0 (2019-05-26)

Features

3.1.3 (2019-05-24)

Bug Fixes

  • types: generates index.d.ts instead of using index.ts directly so skipLibs works correctly (#105) (d733b5b)

3.1.2 (2019-05-24)

Bug Fixes

  • Do not require es6 or downlevel-iterators TS flag (#104) (f91cdd3)

3.1.1 (2019-05-24)

Bug Fixes

  • Add instructions for integrating with Jest unit tests (#94) (3bfdd45)

3.1.0 (2019-05-18)

Features

  • Android: Detect and report VPN connections correctly on Android (#95) (1f9e5c1)

3.0.2 (2019-05-18)

Bug Fixes

  • android: Send a "none" status if the device has no active network on launch (#96) (c62cd8b)

3.0.1 (2019-05-17)

Bug Fixes

  • Fix an issue in the Android de-duplication code (de12dd5)

3.0.0 (2019-05-17)

Features

  • New API with full backward compatibility (#84) (1dc6000)

BREAKING CHANGES

  • See the README for full details.