fix(android): webview crash with incognito in Android Lollipop (#799)

This commit is contained in:
tekmin 2019-08-29 22:47:48 +08:00 committed by Thibault Malbranche
parent 39e5373d3e
commit 47e9a0b97d
1 changed files with 5 additions and 1 deletions

View File

@ -367,7 +367,11 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
@ReactProp(name = "incognito")
public void setIncognito(WebView view, boolean enabled) {
// Remove all previous cookies
CookieManager.getInstance().removeAllCookies(null);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
CookieManager.getInstance().removeAllCookies(null);
} else {
CookieManager.getInstance().removeAllCookie();
}
// Disable caching
view.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);