From 48d2bce5643fba426c7db75344081fd46136c0c2 Mon Sep 17 00:00:00 2001 From: Website Deployment Script Date: Mon, 18 Nov 2019 23:10:46 +0000 Subject: [PATCH] Deploy website Deploy website version based on c6b9807d1aa856d99413e2563fdaa3e61c6cc85a --- docs/0.10/netinfo.html | 133 ++++++++++++++++++++++++++++++--- docs/0.10/netinfo/index.html | 133 ++++++++++++++++++++++++++++++--- docs/0.11/netinfo.html | 133 ++++++++++++++++++++++++++++++--- docs/0.11/netinfo/index.html | 133 ++++++++++++++++++++++++++++++--- docs/0.12/netinfo.html | 133 ++++++++++++++++++++++++++++++--- docs/0.12/netinfo/index.html | 133 ++++++++++++++++++++++++++++++--- docs/0.13/netinfo.html | 133 ++++++++++++++++++++++++++++++--- docs/0.13/netinfo/index.html | 133 ++++++++++++++++++++++++++++++--- docs/0.14/netinfo.html | 133 ++++++++++++++++++++++++++++++--- docs/0.14/netinfo/index.html | 133 ++++++++++++++++++++++++++++++--- docs/0.15/netinfo.html | 133 ++++++++++++++++++++++++++++++--- docs/0.15/netinfo/index.html | 133 ++++++++++++++++++++++++++++++--- docs/0.16/netinfo.html | 133 ++++++++++++++++++++++++++++++--- docs/0.16/netinfo/index.html | 133 ++++++++++++++++++++++++++++++--- docs/0.6/netinfo.html | 133 ++++++++++++++++++++++++++++++--- docs/0.6/netinfo/index.html | 133 ++++++++++++++++++++++++++++++--- docs/0.7/netinfo.html | 133 ++++++++++++++++++++++++++++++--- docs/0.7/netinfo/index.html | 133 ++++++++++++++++++++++++++++++--- docs/0.8/netinfo.html | 133 ++++++++++++++++++++++++++++++--- docs/0.8/netinfo/index.html | 133 ++++++++++++++++++++++++++++++--- docs/0.9/netinfo.html | 133 ++++++++++++++++++++++++++++++--- docs/0.9/netinfo/index.html | 133 ++++++++++++++++++++++++++++++--- docs/next/textinput.html | 1 + docs/next/textinput/index.html | 1 + js/docs-rating.js | 7 +- 25 files changed, 2712 insertions(+), 223 deletions(-) diff --git a/docs/0.10/netinfo.html b/docs/0.10/netinfo.html index 319a57ef231..a85beb7f3d9 100644 --- a/docs/0.10/netinfo.html +++ b/docs/0.10/netinfo.html @@ -1,4 +1,4 @@ -NetInfo · React Native
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-
Edit

NetInfo

Methods

+
Edit

NetInfo

+

Deprecated. Use react-native-community/react-native-netinfo instead.

+
+

NetInfo exposes info about online/offline status

+
NetInfo.getConnectionInfo().then((connectionInfo) => {
+  console.log(
+    'Initial, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+});
+function handleFirstConnectivityChange(connectionInfo) {
+  console.log(
+    'First change, type: ' +
+      connectionInfo.type +
+      ', effectiveType: ' +
+      connectionInfo.effectiveType,
+  );
+  NetInfo.removeEventListener(
+    'connectionChange',
+    handleFirstConnectivityChange,
+  );
+}
+NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
+
+

ConnectionType enum

+

ConnectionType describes the type of connection the device is using to communicate with the network.

+

Cross platform values for ConnectionType:

+
    +
  • none - device is offline
  • +
  • wifi - device is online and connected via wifi, or is the iOS simulator
  • +
  • cellular - device is connected via Edge, 3G, WiMax, or LTE
  • +
  • unknown - error case and the network status is unknown
  • +
+

Android-only values for ConnectionType:

+
    +
  • bluetooth - device is connected via Bluetooth
  • +
  • ethernet - device is connected via Ethernet
  • +
  • wimax - device is connected via WiMAX
  • +
+

EffectiveConnectionType enum

+

Cross platform values for EffectiveConnectionType:

+
    +
  • 2g
  • +
  • 3g
  • +
  • 4g
  • +
  • unknown
  • +
+

Android

+

To request network info, you need to add the following line to your app's AndroidManifest.xml:

+

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+

Methods

Properties


Reference

Methods

addEventListener()

-
static addEventListener(eventName, handler)
+
NetInfo.addEventListener(eventName, handler);
 
+

Adds an event handler.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.
+

Supported events:

+
    +
  • connectionChange: Fires when the network status changes. The argument to the event handler is an object with keys: +
      +
    • type: A ConnectionType (listed above)
    • +
    • effectiveType: An EffectiveConnectionType (listed above)
    • +
  • +
  • change: This event is deprecated. Listen to connectionChange instead. Fires when the network status changes. The argument to the event handler is one of the deprecated connectivity types listed above.
  • +

removeEventListener()

-
static removeEventListener(eventName, handler)
+
NetInfo.removeEventListener(eventName, handler);
 
+

Removes the listener for network status changes.

+

Parameters:

+ + + + + + + + +
NameTypeRequiredDescription
eventNameenum(connectionChange, change)YesThe change event name.
handlerfunctionYesListener function.

-

fetch()

-
static fetch()
+

getConnectionInfo()

+
NetInfo.getConnectionInfo();
+
+

Returns a promise that resolves to an object with type and effectiveType keys whose values are a ConnectionType and an EffectiveConnectionType), respectively.

+
+

isConnectionExpensive()

+
NetInfo.isConnectionExpensive();
+
+

Available on Android. Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy data usage on that connection due to monetary costs, data limitations or battery/performance issues.

+
NetInfo.isConnectionExpensive()
+.then(isConnectionExpensive => {
+  console.log('Connection is ' + (isConnectionExpensive ? 'Expensive' : 'Not Expensive'));
+})
+.catch(error => {
+  console.error(error);
+});
 

Properties

-
-