https://kotlinlang.org logo
#compose
Title
# compose
a

aiidziis

01/08/2021, 2:33 PM
Hey! Has anyone else encountered issues with AndroidView and WebView? WebView is totally unresponsive.
Copy code
AndroidView(
    viewBlock = ::WebView,
    modifier = Modifier.fillMaxSize()
) { webView ->
    with(webView) {
        settings.javaScriptEnabled = true
        webViewClient = WebViewClient()
        loadUrl("<https://google.com>")
    }
}
This happens on API 24, but have encountered this issue also on API 29.
j

jim

01/15/2021, 11:30 AM
Please feel free to file a bug against Compose and link the bug in this thread.
👍🏻 1
a

aiidziis

01/15/2021, 11:59 AM
j

julioromano

02/12/2021, 8:07 AM
Found this too: https://issuetracker.google.com/issues/174233728 Are the 2 bugs perhaps related?
a

aiidziis

02/12/2021, 8:09 AM
This looks a bit different. In my case WebView doesn’t get rerendered on user input. It doesn’t impact other composables.
j

julioromano

02/12/2021, 8:09 AM
I was also planning to use a Webview in an AndroidView, are there any known workarounds?
a

aiidziis

02/12/2021, 8:13 AM
If I knew that there is this Issues I would use Fragment for the screen which needs WebView and avoid hosting WebView inside AndroidView until this issue is fixed. But that actually means that you can’t use Jetpack Compose Navigation as well.
b

bohregard

02/15/2021, 3:41 AM
I filed a similar bug back in Dev14: https://issuetracker.google.com/issues/159838005
m

Mihai Popa

02/19/2021, 1:42 PM
https://issuetracker.google.com/issues/177561480 was fixed and the fix will be available in the next releases
🎉 1
🙇🏻 1
For https://issuetracker.google.com/issues/174233728 please see the workaround I am suggesting