https://kotlinlang.org logo
#compose-desktop
Title
# compose-desktop
z

Zoff

10/24/2023, 12:03 PM
i have a LazyColumn with a VerticalScrollbar. how can i know if the vertical scrollbar is at the bottom position? so that in my chat messages view it will only scoll to bottom on new incoming message when it was at the bottom. but when the user scrolls somewhere it should not automatically scroll to bottom on a new message incoming
s

Stefan Oltmann

10/24/2023, 12:15 PM
LazyListState
has a
canScrollForward
property that you can check. And scrolling on new messages can be achieved by an
LaunchEffect
.
thank you color 1
z

Zoff

10/24/2023, 1:14 PM
is there a minial example. for some reason that property seems randomly true/false even when the scrollbar is in the same positon
also the scrollbar always scrolls down. maybe i am doing something wrong with my items data
s

Stefan Oltmann

10/24/2023, 1:15 PM
What is your condition for the launch effect?
z

Zoff

10/25/2023, 6:37 AM
Copy code
LaunchedEffect(messages.last().msgDatabaseId)
s

Stefan Oltmann

10/25/2023, 6:37 AM
Looks plausible
For the randomly true/false I would suggest that you create a small reproducer app and report an issue.
This is the template I usually use for that: https://github.com/JetBrains/compose-multiplatform-template
3 Views