Sinan Gunes
03/08/2021, 6:13 PM#AndroidDevChallenge
… My github actions fails on this test:
com.example.androiddevchallenge.ExampleInstrumentedTest > sampleTest[test(AVD) - 10] FAILED
254
kotlin.UninitializedPropertyAccessException: lateinit property remeasurement has not been initialized
255
at androidx.compose.foundation.lazy.LazyListState.snapToItemIndexInternal$foundation_release(LazyListState.kt:186)
I haven’t touch that part. Any of you faced similar?Andrey Kulikov
03/08/2021, 6:46 PMsnapToItemIndex
seems to be called before measuring finished. from where do you call it?Sinan Gunes
03/08/2021, 7:00 PMBox() {
val scrollState = rememberLazyListState()
LazyRow(state = scrollState) {
items(1000) {
Text(text = text(it))
}
}
scope.launch {
scrollState.scrollToItem(index, scroll)
}
}
Andrey Kulikov
03/08/2021, 8:05 PMrememberLazyListState()
functionShivam Sethi
03/09/2021, 8:03 AMBenjO
03/09/2021, 8:05 AMSinan Gunes
03/09/2021, 8:08 AMAlbert Chang
03/09/2021, 8:23 AMLaunchedEffect
.Sinan Gunes
03/09/2021, 8:24 AMAndrey Kulikov
03/09/2021, 11:36 AMval scrollState = key(index, scroll) { rememberLazyListState(index, scroll) }
LazyRow(state = scrollState)
Sinan Gunes
03/09/2021, 6:09 PMLaunchedEffect(scrollState) {
snapshotFlow { scrollState.firstVisibleItemIndex + (scrollState.firstVisibleItemScrollOffset / cellWidthPx).roundToInt() }
.distinctUntilChanged()
.filterNot { counting }
.onEach {
onScrolled(it)
}
.collect()
}