Skip to content

Commit d9c0dfe

Browse files
matt-oakesfacebook-github-bot
authored andcommitted
Add a deprecation warning when importing NetInfo (#23383)
Summary: Add a deprecation warning for the `NetInfo` module as part of #23313. [General] [Deprecated] - Deprecated NetInfo as it has now been moved to react-native-community/netinfo Pull Request resolved: #23383 Differential Revision: D14024702 Pulled By: cpojer fbshipit-source-id: 353a9fb86feba2ca7f948c618c642e40fcdbfada
1 parent bf888a7 commit d9c0dfe

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Libraries/react-native/react-native-implementation.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ module.exports = {
173173
'webview-moved',
174174
'WebView has been extracted from react-native core and will be removed in a future release. ' +
175175
"It can now be installed and imported from 'react-native-webview' instead of 'react-native'. " +
176-
'See https://github.com/react-native-community/react-native-webview for more informations.',
176+
'See https://github.com/react-native-community/react-native-webview',
177177
);
178178
return require('WebView');
179179
},
@@ -252,6 +252,12 @@ module.exports = {
252252
return require('NativeEventEmitter');
253253
},
254254
get NetInfo() {
255+
warnOnce(
256+
'netinfo-moved',
257+
'NetInfo has been extracted from react-native core and will be removed in a future release. ' +
258+
"It can now be installed and imported from '@react-native-community/netinfo' instead of 'react-native'. " +
259+
'See https://github.com/react-native-community/react-native-netinfo',
260+
);
255261
return require('NetInfo');
256262
},
257263
get PanResponder() {

0 commit comments

Comments
 (0)