Update the NetInfo.isConnected example code so that it uses the new connectionChange event

Summary:
The first code block already uses the new `connectionChange` event instead of
the deprecated `change` event, so change this example code block as well to use
the new event.

I came across this while upgrading my RN version. In the debug-console I saw a deprecation warning, despite I was using the example-code. Looking at the source, I saw the example code block still used the deprecated event, so update it to use the new one.
Closes https://github.com/facebook/react-native/pull/16357

Differential Revision: D6054428

Pulled By: hramos

fbshipit-source-id: 72ef1a79ece7494cda3773461a740dbbdf383e7e
This commit is contained in:
Willem Fibbe 2017-10-13 17:49:29 -07:00 committed by Facebook Github Bot
parent a59d157df4
commit 8b044dcb80

View File

@ -158,12 +158,12 @@ const _isConnectedSubscriptions = new Map();
* function handleFirstConnectivityChange(isConnected) {
* console.log('Then, is ' + (isConnected ? 'online' : 'offline'));
* NetInfo.isConnected.removeEventListener(
* 'change',
* 'connectionChange',
* handleFirstConnectivityChange
* );
* }
* NetInfo.isConnected.addEventListener(
* 'change',
* 'connectionChange',
* handleFirstConnectivityChange
* );
* ```