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: https://github.com/facebook/react-native/pull/23383

Differential Revision: D14024702

Pulled By: cpojer

fbshipit-source-id: 353a9fb86feba2ca7f948c618c642e40fcdbfada
This commit is contained in:
Matt Oakes 2019-02-11 13:33:01 -08:00 committed by Facebook Github Bot
parent bf888a7582
commit d9c0dfe353
1 changed files with 7 additions and 1 deletions

View File

@ -173,7 +173,7 @@ module.exports = {
'webview-moved', 'webview-moved',
'WebView has been extracted from react-native core and will be removed in a future release. ' + 'WebView has been extracted from react-native core and will be removed in a future release. ' +
"It can now be installed and imported from 'react-native-webview' instead of 'react-native'. " + "It can now be installed and imported from 'react-native-webview' instead of 'react-native'. " +
'See https://github.com/react-native-community/react-native-webview for more informations.', 'See https://github.com/react-native-community/react-native-webview',
); );
return require('WebView'); return require('WebView');
}, },
@ -252,6 +252,12 @@ module.exports = {
return require('NativeEventEmitter'); return require('NativeEventEmitter');
}, },
get NetInfo() { get NetInfo() {
warnOnce(
'netinfo-moved',
'NetInfo has been extracted from react-native core and will be removed in a future release. ' +
"It can now be installed and imported from '@react-native-community/netinfo' instead of 'react-native'. " +
'See https://github.com/react-native-community/react-native-netinfo',
);
return require('NetInfo'); return require('NetInfo');
}, },
get PanResponder() { get PanResponder() {