Prashant Priyadarshi
09/21/2020, 6:44 AMScrollableColumn() {
LazyColumnFor(items = list) {item ->
getSampleDataRow(data = item)
}
}
data class SampleData(val url : String, val id: Long, val value : String){
override fun equals(other: Any?): Boolean {
if(!(other is SampleData)) return false
return id.equals((other as SampleData).id)
}
}
Namig Tahmazli
09/21/2020, 6:52 AMgetSampleDataRow(data = item)
As far as I understood this is expected behavior. LazyColumnFor does not lay out all of children at once but only the amount that can be displayed to user. When you scroll since item
becomes different getSampleDataRow(data = item)
gets recomposed again.Yann Badoual
09/21/2020, 7:00 AMLazyColumnFor
inside ScrollableColumn
. You shouldn't have to do this.
Do instead:
LazyColumn {
items(list) { item ->
getSampleData(item)
}
}
Timo Drick
09/21/2020, 9:02 AMPrashant Priyadarshi
09/21/2020, 10:30 AMLazyColumnFor(items = list) {item ->
getSampleDataRow(data = item)
}
Yann Badoual
09/21/2020, 10:32 AM