ソースを参照

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

* Update WebView.ios.js

* Update WebView.ios.js
Thibault Malbranche 5 年 前
コミット
4c8024047b
No account linked to committer's email address
共有1 個のファイルを変更した8 個の追加1 個の削除を含む
  1. 8
    1
      js/WebView.ios.js

+ 8
- 1
js/WebView.ios.js ファイルの表示

@@ -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