alcat2008 / react-drag-list

A simple draggable list component。

Home Page:http://front-ender.me/react-drag-list/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

disabled prop doesn't work when updating it programatically

mauriciosoares opened this issue · comments

When I update the value from the disabled prop, the component does not react to its change, unless it's unmounted and mounted again. Meaning that if I set disabled to true using a button in the UI for example, the drag and drop functionality is still working.

Here's a example of the bug with the latest version of react-drag-list and a demo I got from the docs: https://codesandbox.io/s/laughing-dew-4gghz

For people having this issue, a way to work around this is to set a key prop to ReactDragList, and change it whenever you change the disabled prop.

This will cause the component to remount, and the disabled works as expected