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