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

Alexander Karkossa

05/30/2021, 8:37 PM
Hey. Maybe someone can help me. After the change to
compose 1.0.0-beta07
various items disappear when scrolling in
LazyColumn
. I could reproduce the problem in a minimal example by inserting a
Box
inside a
LazyColumn
between
AnimatedVisibility
and the actual
Card
(the same happens with e.g.
Column
). Example in my answer
Copy code
val items = listOf(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30)
Surface(modifier = Modifier.fillMaxSize()) {
    LazyColumn {
        items(
            items
        ) { item ->
            AnimatedVisibility(
                visible = true
            ) {
                Box { //FIXME Remove this one and no item will disappear
                    Card(
                        modifier = Modifier
                            .requiredHeight(250.dp)
                            .fillMaxWidth(),
                        backgroundColor = Color(
                            red = 0x00,
                            green = 0x00,
                            blue = (item / 30f * 0xFF).toInt()
                        ),
                        shape = RoundedCornerShape(20.dp),
                    ) {
                        Text(text = "$item")
                    }
                }
            }
        }
    }
}
Without the
Box
With the
Box
k

Kirill Grouchnikov

05/30/2021, 8:48 PM
a

Alexander Karkossa

05/30/2021, 8:48 PM
😄
😂 1
3 Views