[ios] add enableCache prop support

This commit is contained in:
Salakar
2018-11-20 11:40:49 +00:00
parent 2cd0ed10ae
commit de1e6b6573
3 changed files with 5 additions and 0 deletions
+1
View File
@@ -38,6 +38,7 @@ shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
@property (nonatomic, assign) BOOL hideKeyboardAccessoryView;
@property (nonatomic, assign) BOOL allowsBackForwardNavigationGestures;
@property (nonatomic, copy) NSString *userAgent;
@property (nonatomic, assign) BOOL enableCache;
- (void)postMessage:(NSString *)message;
- (void)injectJavaScript:(NSString *)script;
+3
View File
@@ -94,6 +94,9 @@ static NSString *const MessageHanderName = @"ReactNative";
};
WKWebViewConfiguration *wkWebViewConfig = [WKWebViewConfiguration new];
if (_enableCache) {
wkWebViewConfig.websiteDataStore = [WKWebsiteDataStore defaultDataStore];
}
wkWebViewConfig.userContentController = [WKUserContentController new];
[wkWebViewConfig.userContentController addScriptMessageHandler: self name: MessageHanderName];
wkWebViewConfig.allowsInlineMediaPlayback = _allowsInlineMediaPlayback;
+1
View File
@@ -46,6 +46,7 @@ RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustContentInsets, BOOL)
RCT_EXPORT_VIEW_PROPERTY(hideKeyboardAccessoryView, BOOL)
RCT_EXPORT_VIEW_PROPERTY(allowsBackForwardNavigationGestures, BOOL)
RCT_EXPORT_VIEW_PROPERTY(userAgent, NSString)
RCT_EXPORT_VIEW_PROPERTY(enableCache, BOOL)
/**
* Expose methods to enable messaging the webview.