diff --git a/releases/next/docs/netinfo.html b/releases/next/docs/netinfo.html index c9937510171..54c3b12d5ca 100644 --- a/releases/next/docs/netinfo.html +++ b/releases/next/docs/netinfo.html @@ -15,10 +15,14 @@ NetInfo.addE app's AndroidManifest.xml:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> Asynchronously determine if the device is connected and details about that connection.

Android Connectivity Types.

The rest ConnectivityStates are hidden by the Android API, but can be used if necessary.

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((isConnectionExpensive) => { +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); });

isConnected #

Available on all platforms. Asynchronously fetch a boolean to determine -internet connectivity.

NetInfo.isConnected.fetch().done((isConnected) => { +internet connectivity.

NetInfo.isConnected.fetch().then(isConnected => { console.log('First, is ' + (isConnected ? 'online' : 'offline')); }); function handleFirstConnectivityChange(isConnected) { @@ -31,7 +35,7 @@ internet connectivity.

NetInfo.isConnected.addEventListener( 'change', handleFirstConnectivityChange -);

Methods #

static addEventListener(eventName: ChangeEventName, handler: Function) #

static removeEventListener(eventName: ChangeEventName, handler: Function) #

static fetch() #

static isConnectionExpensive(callback: (metered: ?boolean, error?: string) => void) #

Properties #

isConnected: ObjectExpression #

Examples #

Edit on GitHub
'use strict'; +);

Methods #

static addEventListener(eventName: ChangeEventName, handler: Function) #

static removeEventListener(eventName: ChangeEventName, handler: Function) #

static fetch() #

static isConnectionExpensive() #

Properties #

isConnected: ObjectExpression #

Examples #

Edit on GitHub
'use strict'; const React = require('react-native'); const { @@ -152,8 +156,8 @@ const IsConnectionExpensive = React}; }, _checkIfExpensive() { - NetInfo.isConnectionExpensive( - (isConnectionExpensive) => { this.setState({isConnectionExpensive}); } + NetInfo.isConnectionExpensive().then( + isConnectionExpensive => { this.setState({isConnectionExpensive}); } ); }, render() {