compose beta02 Hi, I have a problem with LazyColum...
# compose
m
compose beta02 Hi, I have a problem with LazyColumn, AndroidViewBinding, and CoilImage. When I scroll view which is delivered by AndroidView is not attach to CoilImage video:
🧵 5
m
Copy code
ComposeView(requireContext()).apply {
    setContent {
        val scroll = rememberLazyListState()
        CompositionLocalProvider(LocalImageLoader provides imageLoader) {
            MdcTheme {
                val state by viewModel.collectAsState(HomeState::list)
                LazyColumn(modifier = Modifier.fillMaxSize(), content = {
                    itemsIndexed(state, key = { _, item -> item.id }) { index, item ->
                        Column {
                            AndroidViewBinding(TopMemeInfoContainerBinding::inflate, modifier = Modifier.clipToBounds()) {
                                this.comment.commentsSize = 12
                                this.memDescription.text = "Title"
                            }
                            CoilImage(
                                data = "<https://picsum.photos/1080/500>"
                            ) { imageState ->
                                when (imageState) {
                                    is ImageLoadState.Success -> {
                                        MaterialLoadingImage(
                                            result = imageState,
                                            contentDescription = "My content description",
                                            fadeInEnabled = true,
                                            fadeInDurationMs = 600,
                                        )
                                    }
                                    is ImageLoadState.Loading -> {
                                        Box(
                                            modifier = Modifier
                                                .width(1080.dp)
                                                .height(500.dp),
                                            contentAlignment = Alignment.Center
                                        ) {
                                            CircularProgressIndicator(color = MaterialTheme.colors.secondary)
                                        }
                                    }
                                    else -> Box(
                                        modifier = Modifier
                                            .width(1080.dp)
                                            .height(500.dp)
                                    )
                                }
                            }
                        }
                    }
                }, state = scroll)
            }
        }
    }
}
I can replace CoilImage with Image, another composable and the behaviour is the same, also when I use
Copy code
AndroidView({TextView(it)})
c
Could this be the AndroidView position bug that started happening in beta02? Edit: https://issuetracker.google.com/issues/182485056
m
Thanks @Colton Idle 🙂 "Hi this will be fixed in beta03. In the meantime, as a workaround in beta02, please replace AndroidView with the following composable:"
c
@Mateusz Apacki did you try the workaround provided? Did it work?
m
Yes, its works