mirror of
https://github.com/status-im/react-native-webview.git
synced 2026-08-31 11:41:08 +00:00
feat(android): Expose cacheMode property (#895)
This commit is contained in:
committed by
Thibault Malbranche
parent
902d3d1e7f
commit
5da59251ce
@@ -257,6 +257,27 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
||||
}
|
||||
}
|
||||
|
||||
@ReactProp(name = "cacheMode")
|
||||
public void setCacheMode(WebView view, String cacheModeString) {
|
||||
Integer cacheMode;
|
||||
switch (cacheModeString) {
|
||||
case "LOAD_CACHE_ONLY":
|
||||
cacheMode = WebSettings.LOAD_CACHE_ONLY;
|
||||
break;
|
||||
case "LOAD_CACHE_ELSE_NETWORK":
|
||||
cacheMode = WebSettings.LOAD_CACHE_ELSE_NETWORK;
|
||||
break;
|
||||
case "LOAD_NO_CACHE":
|
||||
cacheMode = WebSettings.LOAD_NO_CACHE;
|
||||
break;
|
||||
case "LOAD_DEFAULT":
|
||||
default:
|
||||
cacheMode = WebSettings.LOAD_DEFAULT;
|
||||
break;
|
||||
}
|
||||
view.getSettings().setCacheMode(cacheMode);
|
||||
}
|
||||
|
||||
@ReactProp(name = "androidHardwareAccelerationDisabled")
|
||||
public void setHardwareAccelerationDisabled(WebView view, boolean disabled) {
|
||||
ReactContext reactContext = (ReactContext) view.getContext();
|
||||
|
||||
Reference in New Issue
Block a user