-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LazyListState.isScrollInProgress is always false on desktop #1423
LazyListState.isScrollInProgress is always false on desktop #1423
Comments
I'm running into this issue too. It seems like on desktop I think it's because of the |
Encountered this problem while trying to synchronize the scroll position of multiple parallel https://stackoverflow.com/questions/71206165/shared-lazyliststate-across-multiple-lazyrow-result-in-strange-behavior?noredirect=1&lq=1, Temporarily worked around this by using val idx = lazyListStateA.firstVisibleItemIndex
val off = lazyListStateA.firstVisibleItemScrollOffset
LaunchedEffect(idx, off) {
lazyListStateB.scrollToItem(idx, off)
} |
It should be mitigated after implementing smooth (animated) scrolling, but if you need to check if there was a scroll, you should subscribe to
Semantics of |
It worth to mention that smooth (animated) scrolling is merged, so currently there is a TODO in code about this flag. Please note that it's still not exactly about mouse wheel, since it's just single-frame event (as explained above). |
|
I tried this LaunchedEffect(lazyListState) {
snapshotFlow {
lazyListState.firstVisibleItemIndex to
lazyListState.firstVisibleItemScrollOffset
}.distinctUntilChanged().collect { (i, offset) ->
println("Changed")
lazyListState.scrollToItem(i, offset)
}
} and it only triggers twice and then scrolling stops working. |
@aljohnston112 It's about #3366. Fixed in JetBrains/compose-multiplatform-core#696 It was because conflicting simultaneous animations (triggered by mouse wheel and by your |
## Proposed Changes - Use `dispatchScroll` with a new `NestedScrollSource.Wheel` instead of direct call of `scrollBy`/`dispatchRawDelta` - Set scrolling priority to `MutatePriority.UserInput` during mouse wheel scroll animation - Move all scroll delta dispatching into a single coroutine - Remove threshold (logic where small delta was applied without animation), `shouldApplyImmediately` flag based on `isPreciseWheelScroll` handles it instead. - Wait `ProgressTimeout` after each mouse wheel event before resetting `isScrollInProgress` flag - Enable this logic by default (old "raw" dispatching failed our tests on iOS) ## Testing Test: Check "NestedScroll" page in mpp demo + unit tests ## Issues Fixed Fixes JetBrains/compose-multiplatform#653 Fixes JetBrains/compose-multiplatform#1423
Compose-jb version: 1.0.0-beta5
kotlin version: 1.5.31
Hi, I want to save the first item position after scroll, here is my code:
it works perfect on Android, isScrollInProgress updated every time the list start to scroll and stop scroll
But on desktop (MacOS BigSur/ Windows10) I found that isScrollInProgress
is always false
even list is clearly in scroll。BTW, I've tested this code both on my project and Compose-jb/examples/imageViewer, the results is the same.The text was updated successfully, but these errors were encountered: