Permalink
Browse files

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 #16357

Differential Revision: D6054428

Pulled By: hramos

fbshipit-source-id: 72ef1a79ece7494cda3773461a740dbbdf383e7e
  • Loading branch information...
fibbers authored and facebook-github-bot committed Oct 14, 2017
1 parent a59d157 commit 8b044dcb8088dd226298c92575d411119eb959dd
Showing with 2 additions and 2 deletions.
  1. +2 −2 Libraries/Network/NetInfo.js
@@ -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
* );
* ```

0 comments on commit 8b044dc

Please sign in to comment.