Skip to content

Commit b5bb679

Browse files
authored
Fix Auto hide Thumb issue #25 (#26)
* add isDraggingList as LaunchedEffect param in ScrollbarScope.Thumb * fix scrollbar not disappearing on desktop
1 parent 5b6a523 commit b5bb679

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

core/src/commonMain/kotlin/ScrollArea.kt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -355,17 +355,14 @@ fun ScrollbarScope.Thumb(
355355
val isHovered by mutableInteractionSource.collectIsHoveredAsState()
356356
val isDraggingList by scrollAreaState.interactionSource.collectIsDraggedAsState()
357357

358-
359-
LaunchedEffect(show) {
360-
if (show) {
361-
delay(thumbVisibility.hideDelay)
362-
show = false
363-
}
364-
}
365-
LaunchedEffect(isDraggingList, isHovered) {
358+
LaunchedEffect(show, isDraggingList, isHovered) {
366359
if (isDraggingList || isHovered) {
367360
show = true
368361
}
362+
if (show && !isHovered) {
363+
delay(thumbVisibility.hideDelay)
364+
show = false
365+
}
369366
}
370367
LaunchedEffect(Unit) {
371368
onScrolledEvents.collect {

0 commit comments

Comments
 (0)