mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-18 08:20:38 +08:00
Added option to set mixed content mode in android webview
Summary: PR for option to set mixed content mode in Webview(Android) for issue #8460 Closes https://github.com/facebook/react-native/pull/12314 Differential Revision: D4663084 Pulled By: lacker fbshipit-source-id: 0e40ea463739166311ddcb7887ff6d0289369637
This commit is contained in:
committed by
Facebook Github Bot
parent
454ab8fc23
commit
36eb69ecd0
@@ -31,6 +31,7 @@ import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebSettings;
|
||||
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
@@ -476,6 +477,19 @@ public class ReactWebViewManager extends SimpleViewManager<WebView> {
|
||||
}
|
||||
}
|
||||
|
||||
@ReactProp(name = "mixedContentMode")
|
||||
public void setMixedContentMode(WebView view, @Nullable String mixedContentMode) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
if (mixedContentMode == null || "never".equals(mixedContentMode)) {
|
||||
view.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_NEVER_ALLOW);
|
||||
} else if ("always".equals(mixedContentMode)) {
|
||||
view.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
} else if ("compatibility".equals(mixedContentMode)) {
|
||||
view.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addEventEmitters(ThemedReactContext reactContext, WebView view) {
|
||||
// Do not register default touch emitter and let WebView implementation handle touches
|
||||
|
||||
Reference in New Issue
Block a user