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

Disable any moves #49

Closed Zykhatslover closed 4 years ago

Zykhatslover commented 4 years ago

I could find an option to entirely disable any movements (let's say I want to lock the table to prevent any action on it).

Is there any change you could add this as a feature or maybe there's already something I could do to mimic it?

Thank's! :-)

tajo commented 4 years ago

I guess you can just have a big top-level conditional to simply render your list of items without using react-movable?

Zykhatslover commented 4 years ago

Mmmh yes I could go for that, but that would duplicate a whole bunch of code and this is what I was trying to avoid, but that's my last option indeed.. Currently, I'm simply allowing any movement, but I cancel it and show a warning if movements are not allowed but an option would be way better

tajo commented 4 years ago

You can also disable items: https://github.com/tajo/react-movable/blob/master/examples/Disabled.tsx#L9

IanVS commented 9 months ago

Replacing the whole UI works, but the downside is that if it is a scroll container and you've scrolled down, when the component is swapped out for the static version, it'll pop back up to the top.

My use case for wanting to disable all moves is to prevent further moves while an API call is being made. Would you consider a disabled prop to List, which would prevent any moves from occurring?