Skip to content

Feature Request: Add a new parameter for a pre-swap check to determine if two items should be swapped. #97

@MankinChung

Description

@MankinChung

We need an API to determine whether two items can swap positions, such as if they are of the same type or group.

@Calvin-LL Is it possible to add a shouldMoveState parameter and its corresponding call here?

shouldMoveState: State<suspend CoroutineScope.(from: LazyListItemInfo, to: LazyListItemInfo) -> Boolean>

it.index != draggingItem.index && shouldMoveState.value.invoke(it, draggingItem)

val targetItem = findTargetItem(
draggingItemRect,
items = state.layoutInfo.visibleItemsInfo,
) {
it.index != draggingItem.index
}

Originally posted by @MankinChung in #91

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions