react-draggable icon indicating copy to clipboard operation
react-draggable copied to clipboard

ASAP Problem with deleting absoluted positioned Components

Open artemderzkiy opened this issue 8 years ago • 4 comments

The problem is that i have >2 elements. When i delete not the last element, the other move out to get other element place. I do not need that behavior. I want each element stay at its place. Is it availiable to be fixed? Or is there a solution on this case?

ASAP

artemderzkiy avatar Mar 29 '18 14:03 artemderzkiy

I had this same issue - I was mapping draggable components to an array of data. And removing the first component of the array was causing the transform of that component to be applied to the next one - by adding unique keys to the data (good practice anyway!) the problem went away.

Hopefully this helps you (and anyone else coming across this problem)

mahoganykilo avatar Sep 18 '18 11:09 mahoganykilo

Allypally's answer solved this problem for me. I was using index as a key (not good), so the shifting indices caused by component removal led to draggable elements inheriting their dead siblings' positions. Switching keys to use UUIDs resolved the issue.

LiveMethod avatar Aug 11 '19 00:08 LiveMethod

You are all my heros. I have been struggling with this for a week now. Giving them each UUIDs on the map solved my problem as well.

mdehaan51 avatar Sep 05 '19 21:09 mdehaan51

This was generated by AI during triage.

Closing old support threads. This one is a usage question, and the answer or workaround is in the thread above. If it's still a problem on 4.7.2, open a new issue with a minimal sandbox.

STRML avatar Sep 27 '26 14:09 STRML