https://kotlinlang.org logo
#decompose
Title
# decompose
v

Vaibhav Jaiswal

03/28/2024, 10:38 AM
Hi @Arkadii Ivanov I have a bottom navigation with 4 tabs A, B, C, D In tab A, I have a pages navigation with two pages A1, A2 and both have a PagingData based lazy column in it Now whats happening is that, If i scroll some items in both the pages, then switch to some other tab B, C etc And come back to A The selected page has the correct scroll state, but the scroll state is lost in the unselected page Same happens if I minimize app and open it again, the scroll state in the unselected page is lost Cc: @लातों वाला भूत
a

Arkadii Ivanov

03/28/2024, 10:48 AM
Hey! Thanks for reporting. This looks like a bug in HorizontalPager. Could you please try without Decompose? Just create a HorizontalPager with two static pages with a static list inside each page.
v

Vaibhav Jaiswal

03/28/2024, 11:03 AM
Same thing happens without Decompose as well
Copy code
@Composable
fun TestPager() {
    val pagerState = rememberPagerState(0){ 2 }
    HorizontalPager(
        state = pagerState,
        modifier = Modifier.fillMaxSize(),
    ){
        TestPage(it)
    }
}

@Composable
fun TestPage(index: Int) {
    val listState = rememberLazyListState()
    LazyColumn(
        state = listState,
        modifier = Modifier.fillMaxSize()
    ){
        items(40) {
            Surface(modifier = Modifier.fillMaxSize()){
                Text(text = "Row $it", modifier = Modifier.padding(16.dp))
            }
        }
    }
}
a

Arkadii Ivanov

03/28/2024, 11:06 AM
Yeah, thanks for checking! In this case there is nothing I could do here. I suggest asking in #compose and/or filing a bug here : https://issuetracker.google.com/issues/new?component=856989&template=1425922
v

Vaibhav Jaiswal

03/28/2024, 12:15 PM
Thanks
👍 1
3 Views