google / accompanist

A collection of extension libraries for Jetpack Compose
https://google.github.io/accompanist
Apache License 2.0
7.43k stars 598 forks source link

[WebView] Problem with Modifier.fillMaxHeight() (and Modifier.fillMaxSize()) #1513

Closed alirahimpour89 closed 1 year ago

alirahimpour89 commented 1 year ago

Description Since you added a frame layout around the webview some websites have started get weird sizing problems. The problem is visible on websites that isn't that tall and doesn't need scrolling. I get white space below the webview.

Steps to reproduce

val url = "https://www.google.com"
val state = rememberWebViewState(url = url)
WebView(
   modifier = Modifier.fillMaxSize(),
   state = state,
   onCreated = { it.settings.javaScriptEnabled = true },
)

Expected behavior When using Modifier.fillMaxSize or fillMaxHeight the WebView should be taking up all available space.

Additional context I have tried adding this to your code: parentLayout.layoutParams = ViewGroup.LayoutParams(width, height) And it works as expected and looks like it did before you added the FrameLayout.

bentrengrove commented 1 year ago

Happy to accept a PR if you want to contribute that. I should be able to get to it soon if not

alirahimpour89 commented 1 year ago

I have made a PR.

alirahimpour89 commented 1 year ago

One of the checks timed out, can I rerun it or do you have to? It's a timeout so I hope it works on next run.

bentrengrove commented 1 year ago

Fixed in #1515