Skip to content

v3.0.0

Latest

Choose a tag to compare

@Calvin-LL Calvin-LL released this 12 Aug 23:37
· 2 commits to main since this release
198f6ec

Thank you @vipulm7 for PR #95

BREAKING CHANGES

ReorderableItem now required in ReorderableColumn and ReorderableRow

needed this to solve #94

ReorderableColumn(
    list = list,
    onSettle = { fromIndex, toIndex ->
        // Update the list
    },
) { index, item, isDragging ->
    key(item.id) {
        // !!! NEW !!!
        ReorderableItem {
            // Item content

            IconButton(modifier = Modifier.draggableHandle(), /* ... */)
        }
    }
}

New default auto scroll item move behavior in grids

onMove is now called with the item below the dragging item instead of the last visible item when auto scrolling.

To revert to the old behavior, pass scrollMoveMode = ScrollMoveMode.INSERT to rememberReorderableLazy*GridState

For onMove to work as the video below,

change

list = list.toMutableList().apply {
    add(to.index, removeAt(from.index))
}

to

list = list.toMutableList().apply {
    this[to.index] = this[from.index].also {
        this[from.index] = this[to.index]
    }
}
NEW old
A video showing an item being reordered in a LazyGrid with ScrollMoveMode.INSERT A video showing an item being reordered in a LazyGrid with ScrollMoveMode.SWAP