google/accompanist

[Webview] fit parent width issue

linhttbk97 opened this issue · 1 comments

Describe the bug

WebView expanded to fit screen width before resize to the parent width

To Reproduce

Example code

val url = flow<
           String> {
       delay(5000)
       emit("https://github.com/google/accompanist/issues/1702")
   }.onStart {
       emit("")
   }
#onCreate 
val webURL by url.collectAsState(initial = "")
Row(Modifier.fillMaxSize()) {
                       Spacer(
                           modifier = Modifier
                               .width(100.dp)
                               .fillMaxHeight()
                               .background(Color.Red)
                       )
                       Box(
                           modifier = Modifier.fillMaxSize(),
                           contentAlignment = Alignment.Center
                       ) {
                           if (webURL.isNotEmpty()) {
                               WebView(state = rememberWebViewState(url = webURL), onCreated = {
                                   it.settings.javaScriptEnabled = true
                               }, modifier = Modifier.fillMaxSize())
                           }
                          Text(text = "sssss")
                       }

                   }

Expected behavior

WebView always fit parent width

Screenshots?

webview.mp4

Environment:

  • Android OS version: 13.0
  • Device: Samsung SM-X110
  • Accompanist version: 0.34.0

Additional context

Add any other context about the problem here.

The Accompanist WebView library has been deprecated and is no longer receiving any updates.