react-beautiful-dnd icon indicating copy to clipboard operation
react-beautiful-dnd copied to clipboard

Inserting item during drag in virtual list(For expand/collapse logic)

Open cryn3t opened this issue 4 years ago • 3 comments

I am facing an issue with expand/collapse in our project during the drag. The way I am doing right now is :- Suppose, If in a virtual list we have 5 items item 1 item 2 item 3 item 4 item 5 And at the time of drag if the destination is on item 2. And item 2 has 4 children. onDragUpdate, we are expanding it. The issue is after expand placeholder is not coming for all the items now in the list. So if the list now is something like this:- item 1 item 2 item 2.1 item 2.2 item 2.3 item 2.4 item 3 item 4 item 5 when I try to drop between 2.4 and 3 I can't. because item 3, item 4, and item 5 are shifting together as if they are one draggable. Below is a similar example where we can see the same issue. Whereat time of destination being index 2. To mock expand/collapse I am adding an item to the list. but then placeholder sometimes won't come in between 2 items and 2 or more than 2 items will shift together. https://codesandbox.io/s/simple-virtual-list-dark-forked-49t1r

https://user-images.githubusercontent.com/49510546/104844223-fcb64400-58f4-11eb-93e3-e5508bffbd13.mov please let me know if I am doing something wrong or have to do it differently.

cryn3t avatar Jan 17 '21 13:01 cryn3t

It seems your problem is connected with https://github.com/atlassian/react-beautiful-dnd/issues/2014 react-beautiful-dnd doesn't support dynamic changes since version 11, unfortunately :(

horprogs avatar Jan 19 '21 18:01 horprogs

Hi, Have you found any solution regarding above mentioned issue. I am also stuck in same position.

ghost avatar Feb 26 '24 07:02 ghost

@NehaElevate at the moment of my comment (3 years ago) we decided to use https://github.com/clauderic/dnd-kit and still using it, no issues

horprogs avatar Feb 27 '24 13:02 horprogs