From a6373ba52a1d983567e313daa624bea6341efd07 Mon Sep 17 00:00:00 2001
From: Website Deployment Script
Date: Mon, 15 Feb 2016 21:57:19 +0000
Subject: [PATCH] Updated docs for next
---
releases/next/docs/netinfo.html | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
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.
NONE - device is offlineBLUETOOTH - The Bluetooth data connection.DUMMY - Dummy data connection.ETHERNET - The Ethernet data connection.MOBILE - The Mobile data connection.MOBILE_DUN - A DUN-specific Mobile data connection.MOBILE_HIPRI - A High Priority Mobile data connection.MOBILE_MMS - An MMS-specific Mobile data connection.MOBILE_SUPL - A SUPL-specific Mobile data connection.VPN - A virtual network using one or more native bearers. Requires API Level 21WIFI - The WIFI data connection.WIMAX - The WiMAX data connection.UNKNOWN - Unknown data connection.
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 isConnectionExpensive(callback: (metered: ?boolean, error?: string) => void) #
Properties #
isConnected: ObjectExpression #
Methods #
static addEventListener(eventName: ChangeEventName, handler: Function) #
static removeEventListener(eventName: ChangeEventName, handler: Function) #
static isConnectionExpensive() #
Properties #
isConnected: ObjectExpression #
'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() {