Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Libraries/Components/WebView/WebView.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ var WebView = React.createClass({
* start playing. The default value is `false`.
*/
mediaPlaybackRequiresUserAction: PropTypes.bool,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no-trailing-spaces: Trailing spaces not allowed.

/**
* Used on Android(5.0+), controls whether Mixed content mode is enabled or not
* @platform android
*/
mixedContentModeEnabled: PropTypes.bool,
},

getInitialState: function() {
Expand All @@ -167,6 +173,7 @@ var WebView = React.createClass({
return {
javaScriptEnabled : true,
scalesPageToFit: true,
mixedContentModeEnabled: false,
};
},

Expand Down Expand Up @@ -229,6 +236,7 @@ var WebView = React.createClass({
onLoadingError={this.onLoadingError}
testID={this.props.testID}
mediaPlaybackRequiresUserAction={this.props.mediaPlaybackRequiresUserAction}
mixedContentModeEnabled={this.props.mixedContentModeEnabled}
/>;

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;

import com.facebook.react.views.webview.events.TopLoadingErrorEvent;
import com.facebook.react.views.webview.events.TopLoadingFinishEvent;
Expand Down Expand Up @@ -306,6 +307,13 @@ public void setInjectedJavaScript(WebView view, @Nullable String injectedJavaScr
((ReactWebView) view).setInjectedJavaScript(injectedJavaScript);
}

@ReactProp(name = "mixedContentModeEnabled")
public void setMixedContentModeEnabled(WebView view, boolean enabled) {
if (enabled && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
view.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry looking at the Android API more closely, I think we want to expose the underlying API: always, never, compatibility as enums.

}
}

@ReactProp(name = "source")
public void setSource(WebView view, @Nullable ReadableMap source) {
if (source != null) {
Expand Down