|  | @@ -1,8 +1,11 @@
 | 
	
		
			
			| 1 | 1 |  package com.reactnativecommunity.webview;
 | 
	
		
			
			| 2 | 2 |  
 | 
	
		
			
			|  | 3 | +import android.annotation.SuppressLint;
 | 
	
		
			
			| 3 | 4 |  import android.annotation.TargetApi;
 | 
	
		
			
			| 4 | 5 |  import android.content.Context;
 | 
	
		
			
			|  | 6 | +
 | 
	
		
			
			| 5 | 7 |  import com.facebook.react.uimanager.UIManagerModule;
 | 
	
		
			
			|  | 8 | +
 | 
	
		
			
			| 6 | 9 |  import java.util.LinkedList;
 | 
	
		
			
			| 7 | 10 |  import java.util.List;
 | 
	
		
			
			| 8 | 11 |  import java.util.regex.Pattern;
 | 
	
	
		
			
			|  | @@ -303,6 +306,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
 | 
	
		
			
			| 303 | 306 |        return new RNCWebViewBridge(webView);
 | 
	
		
			
			| 304 | 307 |      }
 | 
	
		
			
			| 305 | 308 |  
 | 
	
		
			
			|  | 309 | +    @SuppressLint("AddJavascriptInterface")
 | 
	
		
			
			| 306 | 310 |      public void setMessagingEnabled(boolean enabled) {
 | 
	
		
			
			| 307 | 311 |        if (messagingEnabled == enabled) {
 | 
	
		
			
			| 308 | 312 |          return;
 | 
	
	
		
			
			|  | @@ -484,9 +488,15 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
 | 
	
		
			
			| 484 | 488 |    @ReactProp(name = "enableCache")
 | 
	
		
			
			| 485 | 489 |    public void setCacheEnabled(WebView view, boolean enabled) {
 | 
	
		
			
			| 486 | 490 |      if (enabled) {
 | 
	
		
			
			| 487 |  | -      view.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
 | 
	
		
			
			|  | 491 | +      Context ctx = view.getContext();
 | 
	
		
			
			|  | 492 | +      if (ctx != null) {
 | 
	
		
			
			|  | 493 | +        view.getSettings().setAppCachePath(ctx.getCacheDir().getAbsolutePath());
 | 
	
		
			
			|  | 494 | +        view.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
 | 
	
		
			
			|  | 495 | +        view.getSettings().setAppCacheEnabled(true);
 | 
	
		
			
			|  | 496 | +      }
 | 
	
		
			
			| 488 | 497 |      } else {
 | 
	
		
			
			| 489 | 498 |        view.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
 | 
	
		
			
			|  | 499 | +      view.getSettings().setAppCacheEnabled(false);
 | 
	
		
			
			| 490 | 500 |      }
 | 
	
		
			
			| 491 | 501 |    }
 | 
	
		
			
			| 492 | 502 |  
 |