tajo / react-movable

🔀 Drag and drop for your React lists and tables. Accessible. Tiny.
https://react-movable.pages.dev
MIT License
1.53k stars 51 forks source link

Unable to forbid certain item to move at certain index #90

Closed vtarelkin closed 2 months ago

vtarelkin commented 1 year ago

@tajo hi and thank you for your library! I wonder are there any options in onChange handler to forbid to move certain item to certain position (for example at the start of the list) ? Cannot get the value of the dragged element.

vtarelkin commented 1 year ago

this library definitely need some customizing on dragged item.

something like

beforeDrag?: (params: BeforeDragParams) => void;
export interface BeforeDragParams {
    elements: Element[];
    oldIndex: number;
    plannedIndex: number;
}
tajo commented 2 months ago

There is no support for this.