Browse Source

fix(UIWebview): Deprecate UIWebView and add link to issue (#313)

* Update WebView.ios.js

* Update WebView.ios.js
Thibault Malbranche 5 years ago
parent
commit
4c8024047b
No account linked to committer's email address
1 changed files with 8 additions and 1 deletions
  1. 8
    1
      js/WebView.ios.js

+ 8
- 1
js/WebView.ios.js View File

@@ -41,7 +41,7 @@ import type {
41 41
 } from './WebViewTypes';
42 42
 
43 43
 const resolveAssetSource = Image.resolveAssetSource;
44
-
44
+let didWarnAboutUIWebViewUsage = false;
45 45
 // Imported from https://github.com/facebook/react-native/blob/master/Libraries/Components/ScrollView/processDecelerationRate.js
46 46
 function processDecelerationRate(decelerationRate) {
47 47
   if (decelerationRate === 'normal') {
@@ -153,6 +153,13 @@ class WebView extends React.Component<WebViewSharedProps, State> {
153 153
   webViewRef = React.createRef();
154 154
 
155 155
   UNSAFE_componentWillMount() {
156
+    if (!this.props.useWebKit && !didWarnAboutUIWebViewUsage) {
157
+      didWarnAboutUIWebViewUsage = true;
158
+      console.warn(
159
+        'UIWebView is deprecated and will be removed soon, please use WKWebView (do not override useWebkit={true} prop),' +
160
+          ' more infos here: https://github.com/react-native-community/react-native-webview/issues/312',
161
+      );
162
+    }
156 163
     if (
157 164
       this.props.useWebKit === true &&
158 165
       this.props.scalesPageToFit !== undefined