Skip to content

Commit 1bb1385

Browse files
danielbraunFacebook Github Bot 7
authored andcommittedJul 27, 2016
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 #8830 Reviewed By: bestander Differential Revision: D3632821 Pulled By: jamesgpearce fbshipit-source-id: c185bcd30d1d214a357d0d8552d61d0ddfa5e6c6
·
v0.81.0-rc.00.60.2
1 parent aa32fd6 commit 1bb1385

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

‎ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import android.graphics.Bitmap;
1919
import android.os.Build;
2020
import android.text.TextUtils;
21+
import android.view.ViewGroup.LayoutParams;
2122
import android.webkit.GeolocationPermissions;
2223
import android.webkit.WebView;
2324
import android.webkit.WebViewClient;
@@ -267,6 +268,11 @@ public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermiss
267268
webView.getSettings().setBuiltInZoomControls(true);
268269
webView.getSettings().setDisplayZoomControls(false);
269270

271+
// Fixes broken full-screen modals/galleries due to body height being 0.
272+
webView.setLayoutParams(
273+
new LayoutParams(LayoutParams.MATCH_PARENT,
274+
LayoutParams.MATCH_PARENT));
275+
270276
if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
271277
WebView.setWebContentsDebuggingEnabled(true);
272278
}

0 commit comments

Comments
 (0)
Please sign in to comment.