Added WebView deprecation warning (#22980)

Summary:
Changelog:
----------

Help reviewers and the release process by writing your own changelog entry. See http://facebook.github.io/react-native/docs/contributing#changelog for an example.

[General] [Deprecated] - Deprecation warning for WebView as it has been extracted from core.
Pull Request resolved: https://github.com/facebook/react-native/pull/22980

Differential Revision: D13664505

Pulled By: hramos

fbshipit-source-id: 0cfc06015e77c52bed9eeebd97c8cbca6eacd8ce
This commit is contained in:
Thibault Malbranche 2019-01-14 16:50:15 -08:00 committed by Facebook Github Bot
parent 991e83f568
commit f76164f88a

View File

@ -14,6 +14,7 @@ const invariant = require('invariant');
let showedListViewDeprecation = false; let showedListViewDeprecation = false;
let showedSwipeableListViewDeprecation = false; let showedSwipeableListViewDeprecation = false;
let showedWebWiewDeprecation = false;
// Export React, plus some native additions. // Export React, plus some native additions.
module.exports = { module.exports = {
@ -167,6 +168,15 @@ module.exports = {
return require('VirtualizedList'); return require('VirtualizedList');
}, },
get WebView() { get WebView() {
if (!showedWebWiewDeprecation) {
console.warn(
'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'. " +
'See https://github.com/react-native-community/react-native-webview for more informations.',
);
showedWebWiewDeprecation = true;
}
return require('WebView'); return require('WebView');
}, },