Webview: Fix broken fullscreen modals due to zero body height.
Summary: Supersedes PR #8536 Fixes #5211 JavaScript plugins such as Fotorama are broken when attempting use its fullscreen feature. If there's an absolute HTML element with 100% height under <body>, its height is 0 when rendered in the Android WebView. This commit fixes it. Closes https://github.com/facebook/react-native/pull/8830 Reviewed By: bestander Differential Revision: D3632821 Pulled By: jamesgpearce fbshipit-source-id: c185bcd30d1d214a357d0d8552d61d0ddfa5e6c6
This commit is contained in:
parent
aa32fd64a5
commit
1bb1385c7d
|
@ -18,6 +18,7 @@ import java.util.Map;
|
|||
import android.graphics.Bitmap;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.webkit.GeolocationPermissions;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
|
@ -267,6 +268,11 @@ public class ReactWebViewManager extends SimpleViewManager<WebView> {
|
|||
webView.getSettings().setBuiltInZoomControls(true);
|
||||
webView.getSettings().setDisplayZoomControls(false);
|
||||
|
||||
// Fixes broken full-screen modals/galleries due to body height being 0.
|
||||
webView.setLayoutParams(
|
||||
new LayoutParams(LayoutParams.MATCH_PARENT,
|
||||
LayoutParams.MATCH_PARENT));
|
||||
|
||||
if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
WebView.setWebContentsDebuggingEnabled(true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue