Thibault Malbranche 5 vuotta sitten
vanhempi
commit
1148766747

+ 1
- 1
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java Näytä tiedosto

532
     view.getSettings().setJavaScriptEnabled(enabled);
532
     view.getSettings().setJavaScriptEnabled(enabled);
533
   }
533
   }
534
 
534
 
535
-  @ReactProp(name = "enableCache")
535
+  @ReactProp(name = "cacheEnabled")
536
   public void setCacheEnabled(WebView view, boolean enabled) {
536
   public void setCacheEnabled(WebView view, boolean enabled) {
537
     if (enabled) {
537
     if (enabled) {
538
       Context ctx = view.getContext();
538
       Context ctx = view.getContext();

+ 5
- 6
docs/Reference.md Näytä tiedosto

48
 - [`incognito`](Reference.md#incognito)
48
 - [`incognito`](Reference.md#incognito)
49
 - [`allowFileAccess`](Reference.md#allowFileAccess)
49
 - [`allowFileAccess`](Reference.md#allowFileAccess)
50
 - [`saveFormDataDisabled`](Reference.md#saveFormDataDisabled)
50
 - [`saveFormDataDisabled`](Reference.md#saveFormDataDisabled)
51
-- [`enableCache`](Reference.md#enableCache)
51
+- [`cacheEnabled`](Reference.md#cacheEnabled)
52
 - [`pagingEnabled`](Reference.md#pagingEnabled)
52
 - [`pagingEnabled`](Reference.md#pagingEnabled)
53
 - [`allowsLinkPreview`](Reference.md#allowsLinkPreview)
53
 - [`allowsLinkPreview`](Reference.md#allowsLinkPreview)
54
 
54
 
361
 
361
 
362
 Sets the user-agent for the `WebView`. This will only work for iOS if you are using WKWebView, not UIWebView (see https://developer.apple.com/documentation/webkit/wkwebview/1414950-customuseragent).
362
 Sets the user-agent for the `WebView`. This will only work for iOS if you are using WKWebView, not UIWebView (see https://developer.apple.com/documentation/webkit/wkwebview/1414950-customuseragent).
363
 
363
 
364
-| Type   | Required | Platform |
365
-| ------ | -------- | -------- |
366
-| string | No       | Android, iOS WKWebView  |
364
+| Type   | Required | Platform               |
365
+| ------ | -------- | ---------------------- |
366
+| string | No       | Android, iOS WKWebView |
367
 
367
 
368
 ---
368
 ---
369
 
369
 
554
 
554
 
555
 ---
555
 ---
556
 
556
 
557
-### `enableCache`
557
+### `cacheEnabled`
558
 
558
 
559
 Sets whether WebView & WKWebView should use browser caching.
559
 Sets whether WebView & WKWebView should use browser caching.
560
 
560
 
582
 | ------- | -------- | -------- |
582
 | ------- | -------- | -------- |
583
 | boolean | No       | iOS      |
583
 | boolean | No       | iOS      |
584
 
584
 
585
-
586
 ## Methods
585
 ## Methods
587
 
586
 
588
 ### `extraNativeComponentConfig()`
587
 ### `extraNativeComponentConfig()`

+ 1
- 1
ios/RNCWKWebView.h Näytä tiedosto

41
 @property (nonatomic, assign) BOOL incognito;
41
 @property (nonatomic, assign) BOOL incognito;
42
 @property (nonatomic, assign) BOOL useSharedProcessPool;
42
 @property (nonatomic, assign) BOOL useSharedProcessPool;
43
 @property (nonatomic, copy) NSString *userAgent;
43
 @property (nonatomic, copy) NSString *userAgent;
44
-@property (nonatomic, assign) BOOL enableCache;
44
+@property (nonatomic, assign) BOOL cacheEnabled;
45
 @property (nonatomic, assign) BOOL allowsLinkPreview;
45
 @property (nonatomic, assign) BOOL allowsLinkPreview;
46
 
46
 
47
 - (void)postMessage:(NSString *)message;
47
 - (void)postMessage:(NSString *)message;

+ 1
- 1
ios/RNCWKWebView.m Näytä tiedosto

83
     WKWebViewConfiguration *wkWebViewConfig = [WKWebViewConfiguration new];
83
     WKWebViewConfiguration *wkWebViewConfig = [WKWebViewConfiguration new];
84
     if (_incognito) {
84
     if (_incognito) {
85
       wkWebViewConfig.websiteDataStore = [WKWebsiteDataStore nonPersistentDataStore];
85
       wkWebViewConfig.websiteDataStore = [WKWebsiteDataStore nonPersistentDataStore];
86
-    } else if (_enableCache) {
86
+    } else if (_cacheEnabled) {
87
       wkWebViewConfig.websiteDataStore = [WKWebsiteDataStore defaultDataStore];
87
       wkWebViewConfig.websiteDataStore = [WKWebsiteDataStore defaultDataStore];
88
     }
88
     }
89
     if(self.useSharedProcessPool) {
89
     if(self.useSharedProcessPool) {

+ 1
- 1
ios/RNCWKWebViewManager.m Näytä tiedosto

48
 RCT_EXPORT_VIEW_PROPERTY(incognito, BOOL)
48
 RCT_EXPORT_VIEW_PROPERTY(incognito, BOOL)
49
 RCT_EXPORT_VIEW_PROPERTY(pagingEnabled, BOOL)
49
 RCT_EXPORT_VIEW_PROPERTY(pagingEnabled, BOOL)
50
 RCT_EXPORT_VIEW_PROPERTY(userAgent, NSString)
50
 RCT_EXPORT_VIEW_PROPERTY(userAgent, NSString)
51
-RCT_EXPORT_VIEW_PROPERTY(enableCache, BOOL)
51
+RCT_EXPORT_VIEW_PROPERTY(cacheEnabled, BOOL)
52
 RCT_EXPORT_VIEW_PROPERTY(allowsLinkPreview, BOOL)
52
 RCT_EXPORT_VIEW_PROPERTY(allowsLinkPreview, BOOL)
53
 
53
 
54
 /**
54
 /**

+ 7
- 4
js/WebView.android.js Näytä tiedosto

17
   StyleSheet,
17
   StyleSheet,
18
   UIManager,
18
   UIManager,
19
   View,
19
   View,
20
-  NativeModules
20
+  NativeModules,
21
 } from 'react-native';
21
 } from 'react-native';
22
 
22
 
23
 import invariant from 'fbjs/lib/invariant';
23
 import invariant from 'fbjs/lib/invariant';
67
     scalesPageToFit: true,
67
     scalesPageToFit: true,
68
     allowFileAccess: false,
68
     allowFileAccess: false,
69
     saveFormDataDisabled: false,
69
     saveFormDataDisabled: false,
70
-    enableCache: true,
70
+    cacheEnabled: true,
71
     androidHardwareAccelerationDisabled: false,
71
     androidHardwareAccelerationDisabled: false,
72
     originWhitelist: defaultOriginWhitelist,
72
     originWhitelist: defaultOriginWhitelist,
73
   };
73
   };
75
   static isFileUploadSupported = async () => {
75
   static isFileUploadSupported = async () => {
76
     // native implementation should return "true" only for Android 5+
76
     // native implementation should return "true" only for Android 5+
77
     return NativeModules.RNCWebView.isFileUploadSupported();
77
     return NativeModules.RNCWebView.isFileUploadSupported();
78
-  }
78
+  };
79
 
79
 
80
   state = {
80
   state = {
81
     viewState: this.props.startInLoadingState
81
     viewState: this.props.startInLoadingState
152
         injectedJavaScript={this.props.injectedJavaScript}
152
         injectedJavaScript={this.props.injectedJavaScript}
153
         userAgent={this.props.userAgent}
153
         userAgent={this.props.userAgent}
154
         javaScriptEnabled={this.props.javaScriptEnabled}
154
         javaScriptEnabled={this.props.javaScriptEnabled}
155
-        androidHardwareAccelerationDisabled={this.props.androidHardwareAccelerationDisabled}
155
+        androidHardwareAccelerationDisabled={
156
+          this.props.androidHardwareAccelerationDisabled
157
+        }
156
         thirdPartyCookiesEnabled={this.props.thirdPartyCookiesEnabled}
158
         thirdPartyCookiesEnabled={this.props.thirdPartyCookiesEnabled}
157
         domStorageEnabled={this.props.domStorageEnabled}
159
         domStorageEnabled={this.props.domStorageEnabled}
158
         messagingEnabled={typeof this.props.onMessage === 'function'}
160
         messagingEnabled={typeof this.props.onMessage === 'function'}
161
+        cacheEnabled={this.props.cacheEnabled}
159
         onMessage={this.onMessage}
162
         onMessage={this.onMessage}
160
         overScrollMode={this.props.overScrollMode}
163
         overScrollMode={this.props.overScrollMode}
161
         contentInset={this.props.contentInset}
164
         contentInset={this.props.contentInset}

+ 7
- 7
js/WebView.ios.js Näytä tiedosto

133
 
133
 
134
   static defaultProps = {
134
   static defaultProps = {
135
     useWebKit: true,
135
     useWebKit: true,
136
-    enableCache: true,
136
+    cacheEnabled: true,
137
     originWhitelist: defaultOriginWhitelist,
137
     originWhitelist: defaultOriginWhitelist,
138
     useSharedProcessPool: true,
138
     useSharedProcessPool: true,
139
   };
139
   };
141
   static isFileUploadSupported = async () => {
141
   static isFileUploadSupported = async () => {
142
     // no native implementation for iOS, depends only on permissions
142
     // no native implementation for iOS, depends only on permissions
143
     return true;
143
     return true;
144
-  }
144
+  };
145
 
145
 
146
   state = {
146
   state = {
147
     viewState: this.props.startInLoadingState
147
     viewState: this.props.startInLoadingState
170
       );
170
       );
171
     }
171
     }
172
 
172
 
173
-    if (
174
-      !this.props.useWebKit &&
175
-      this.props.incognito
176
-    ) {
173
+    if (!this.props.useWebKit && this.props.incognito) {
177
       console.warn(
174
       console.warn(
178
         'The incognito property is not supported when useWebKit = false',
175
         'The incognito property is not supported when useWebKit = false',
179
       );
176
       );
255
         bounces={this.props.bounces}
252
         bounces={this.props.bounces}
256
         scrollEnabled={this.props.scrollEnabled}
253
         scrollEnabled={this.props.scrollEnabled}
257
         pagingEnabled={this.props.pagingEnabled}
254
         pagingEnabled={this.props.pagingEnabled}
255
+        cacheEnabled={this.props.cacheEnabled}
258
         decelerationRate={decelerationRate}
256
         decelerationRate={decelerationRate}
259
         contentInset={this.props.contentInset}
257
         contentInset={this.props.contentInset}
260
         automaticallyAdjustContentInsets={
258
         automaticallyAdjustContentInsets={
261
           this.props.automaticallyAdjustContentInsets
259
           this.props.automaticallyAdjustContentInsets
262
         }
260
         }
263
         hideKeyboardAccessoryView={this.props.hideKeyboardAccessoryView}
261
         hideKeyboardAccessoryView={this.props.hideKeyboardAccessoryView}
264
-        allowsBackForwardNavigationGestures={this.props.allowsBackForwardNavigationGestures}
262
+        allowsBackForwardNavigationGestures={
263
+          this.props.allowsBackForwardNavigationGestures
264
+        }
265
         incognito={this.props.incognito}
265
         incognito={this.props.incognito}
266
         userAgent={this.props.userAgent}
266
         userAgent={this.props.userAgent}
267
         onLoadingStart={this._onLoadingStart}
267
         onLoadingStart={this._onLoadingStart}

+ 1
- 1
js/WebViewTypes.js Näytä tiedosto

491
   /**
491
   /**
492
    * Should caching be enabled. Default is true.
492
    * Should caching be enabled. Default is true.
493
    */
493
    */
494
-  enableCache?: ?boolean,
494
+  cacheEnabled?: ?boolean,
495
 
495
 
496
   style?: ViewStyleProp,
496
   style?: ViewStyleProp,
497
   children: Node,
497
   children: Node,