Skip to content

Commit

Permalink
fix last visible item move backwards on scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
Calvin-LL committed May 13, 2024
1 parent 3563c55 commit 3b68632
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,14 @@ open class ReorderableLazyCollectionState<out T> internal constructor(
onMoveStateMutex.unlock()
return
}
val isDraggingItemAtEnd = when (direction) {
Scroller.Direction.FORWARD -> draggingItem.index == state.layoutInfo.visibleItemsInfo.lastOrNull()?.index
Scroller.Direction.BACKWARD -> draggingItem.index == state.firstVisibleItemIndex
}
if (isDraggingItemAtEnd) {
onMoveStateMutex.unlock()
return
}
val dragOffset = draggingItemOffset.reverseAxisIfNecessary()
.reverseAxisWithLayoutDirectionIfLazyVerticalStaggeredGridRtlFix()
val startOffset = draggingItem.offset.toOffset() + dragOffset
Expand Down

0 comments on commit 3b68632

Please sign in to comment.