Stuttering scrolling on profile
Jerboa Version 0.0.38
Android version + phone Android 13, Galaxy S23
Describe the bug Suddenly changing the scrolling direction on profile makes the screen stutters for a bit before behaving correctly. It's more noticeable if you're scrolling fast.
To Reproduce Steps to reproduce the behavior:
- Go to any Profile
- Go to Comments
- Pull the screen to scroll down
- While the view is scrolling, scroll up
https://github.com/dessalines/jerboa/assets/3781478/51beab75-0476-412d-9258-1d283f8a4d9d
This has something to do with the HorizontalPager in a Scafford with a collapsing TopAppBar. I'm able to reproduce it using basic components like
val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior(rememberTopAppBarState())
Scaffold(
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
topBar = {
TopAppBar(
scrollBehavior = scrollBehavior,
title = {
Text("Hello")
},
)
},
content = {
Column(
modifier = Modifier.padding(it),
) {
val pagerState = rememberPagerState { 3 }
HorizontalPager(
state = pagerState,
modifier = Modifier.fillMaxSize(),
) {
val listState = rememberLazyListState()
LazyColumn(
state = listState,
modifier = Modifier
.fillMaxSize()
) {
items(200) {
Text("Hello${it}")
}
}
}
}
},
)
Screen_recording_20230719_190807.webm
If you take away either the HorizontalPager or remove the collapsible behavior of the TopAppBar it works fine with no freeze/stutter.
@yate your hint about the collapsible TopAppBar was helpful. Pinning the TopAppBar seems to help avoid a large number of recompositions on other activities as well.
Seems like a jetpack compose issue. If someone wants to work on this, I can re-open.