WebView is not scrolling inside Compose. I need to put the WebView inside BottomSheet using the Compose. The problem that WebView is not scrolling even if we use e.g. NestedWebView, or NestedScrollWebView. If I put WebView inside NestedScrollView it still doesn't react on scroll.
BottomSheetScaffold(
sheetContent = {
AndroidView(factory = {
NestedWebView(it).apply {
layoutParams = ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
)
settings.domStorageEnabled = true
settings.javaScriptEnabled = true
settings.useWideViewPort = true
webViewClient = WebViewClient()
//loadUrl("https://contest.rippl.club/")
loadUrl("https://codeflarelimited.com")
}
})
}) {
}
One of the workaround is to use verticalScroll and set the webview height as WRAP_CONTENT:
val scrollState = rememberScrollState()
AndroidView(modifier = Modifier.verticalScroll(scrollState), factory = {
WebView(it).apply {
layoutParams = ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
---//---
but there are a lot of sites that doesnt work with wrap_content for e.g. because of inner scrolling like this site https://contest.rippl.club/. This site doesn't work with that workaround. If we set the webview height as screen height that it still doesnt work, because the verticalScroll works as ScrollView, so it will just scroll until this height.
I've also checked this doc https://developer.android.com/jetpack/compose/gestures#parent-compose-child-view, but nothing works for webview case.