VerticalFastScroller: Fix scroller consuming touch when it's invisible (#7484)

This commit is contained in:
Ivan Iskandar 2022-07-09 20:20:47 +07:00 committed by GitHub
parent da7a64b40d
commit 9385b86ecb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -121,11 +121,10 @@ fun VerticalFastScroller(
.offset { IntOffset(0, thumbOffsetY.roundToInt()) } .offset { IntOffset(0, thumbOffsetY.roundToInt()) }
.then( .then(
// Recompose opts // Recompose opts
if (!listState.isScrollInProgress) { if (isThumbVisible && !listState.isScrollInProgress) {
Modifier.draggable( Modifier.draggable(
interactionSource = dragInteractionSource, interactionSource = dragInteractionSource,
orientation = Orientation.Vertical, orientation = Orientation.Vertical,
enabled = isThumbVisible,
state = rememberDraggableState { delta -> state = rememberDraggableState { delta ->
val newOffsetY = thumbOffsetY + delta val newOffsetY = thumbOffsetY + delta
thumbOffsetY = newOffsetY.coerceIn(thumbTopPadding, thumbTopPadding + trackHeightPx) thumbOffsetY = newOffsetY.coerceIn(thumbTopPadding, thumbTopPadding + trackHeightPx)