'Cancel drag or disable reorder

Is there a way to cancel drop action of react-beautiful-dnd's Draggable object? I have a list of items with one item to be always at last position. enter image description here

I want to disable (or at least properly cancel) drop if item is dragged below last item. I know I can exclude last item from droppable component and area, but that's not an option.



Solution 1:[1]

It is simple

When you drop any element in the onDragEnd method you'll get an object for destination and source so in that destination you find one index.

This index is referred to as your element at that index in your list of elements.

So you can make one condition there like if your element list length is equal to your index then don't do nothing return from that function.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Akash Chavda