Skip to content

Commit 8b044dc

Browse files
fibbersfacebook-github-bot
authored andcommitted
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 facebook#16357 Differential Revision: D6054428 Pulled By: hramos fbshipit-source-id: 72ef1a79ece7494cda3773461a740dbbdf383e7e
1 parent a59d157 commit 8b044dc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Libraries/Network/NetInfo.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ const _isConnectedSubscriptions = new Map();
158158
* function handleFirstConnectivityChange(isConnected) {
159159
* console.log('Then, is ' + (isConnected ? 'online' : 'offline'));
160160
* NetInfo.isConnected.removeEventListener(
161-
* 'change',
161+
* 'connectionChange',
162162
* handleFirstConnectivityChange
163163
* );
164164
* }
165165
* NetInfo.isConnected.addEventListener(
166-
* 'change',
166+
* 'connectionChange',
167167
* handleFirstConnectivityChange
168168
* );
169169
* ```

0 commit comments

Comments
 (0)