I have a webview and its not displayed if I dont s...
# compose
v
I have a webview and its not displayed if I dont specify a height I want it to grow according to the height My main use case is to embed tweets, reddit post etc This is happening only on iOS, I'm using this library If I set a fixed height it works correctly otherwise nothing is displayed
Reproducer:-
Copy code
@Composable
fun ListItem(modifier: Modifier = Modifier) {

    val state = rememberWebViewState("<https://oembed.link/https://x.com/SpaceX/status/1732824684683784516?s=20>")

    LaunchedEffect(Unit) {
        state.webSettings.apply {
            isJavaScriptEnabled = true
            iOSWebSettings.apply {
                scrollEnabled = false
            }
        }
    }
    Row(
        modifier = modifier.height(IntrinsicSize.Max),
        horizontalArrangement = Arrangement.spacedBy(8.dp)
    ) {
        Box(modifier = Modifier.width(64.dp).fillMaxHeight().background(Color.Gray))
        Column(modifier = Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(8.dp)) {
            Box(modifier = Modifier.fillMaxWidth().background(Color.Red).height(30.dp))
            Box(modifier = Modifier.fillMaxWidth().background(Color.Green).height(64.dp))
            WebView(
                state = state,
                modifier = Modifier.fillMaxWidth().clip(RoundedCornerShape(8.dp)),
                captureBackPresses = false
            )
            Box(modifier = Modifier.fillMaxWidth().background(Color.Blue).height(30.dp))
        }
    }
}
z
Not sure why you’re reporting that here - sounds like a bug/feature request for the web view library you’re using.
u
Its not a library bug. Even an expect actual implementation gives same issues
z
It sounds like you want the web view to be able to provide its own height but that’s not a feature the web view supports. If so, that doesn’t have anything to do with compose.