Ver código fonte

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

* Update WebView.ios.js

* Update WebView.ios.js
Thibault Malbranche 5 anos atrás
pai
commit
4c8024047b
Nenhuma conta vinculada ao e-mail do autor do commit
1 arquivos alterados com 8 adições e 1 exclusões
  1. 8
    1
      js/WebView.ios.js

+ 8
- 1
js/WebView.ios.js Ver arquivo

41
 } from './WebViewTypes';
41
 } from './WebViewTypes';
42
 
42
 
43
 const resolveAssetSource = Image.resolveAssetSource;
43
 const resolveAssetSource = Image.resolveAssetSource;
44
-
44
+let didWarnAboutUIWebViewUsage = false;
45
 // Imported from https://github.com/facebook/react-native/blob/master/Libraries/Components/ScrollView/processDecelerationRate.js
45
 // Imported from https://github.com/facebook/react-native/blob/master/Libraries/Components/ScrollView/processDecelerationRate.js
46
 function processDecelerationRate(decelerationRate) {
46
 function processDecelerationRate(decelerationRate) {
47
   if (decelerationRate === 'normal') {
47
   if (decelerationRate === 'normal') {
153
   webViewRef = React.createRef();
153
   webViewRef = React.createRef();
154
 
154
 
155
   UNSAFE_componentWillMount() {
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
     if (
163
     if (
157
       this.props.useWebKit === true &&
164
       this.props.useWebKit === true &&
158
       this.props.scalesPageToFit !== undefined
165
       this.props.scalesPageToFit !== undefined