Skip to content

Commit

Permalink
fix: allow update disabled prop at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
i-akhmadullin committed Oct 21, 2020
1 parent a104520 commit dccdd24
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/react-sortable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
const newOptions = this.makeOptions();
Sortable.create(this.ref.current, newOptions);
}
componentDidUpdate(prevProps: ReactSortableProps<T>): void {
if (prevProps.disabled !== this.props.disabled && this.sortable) {
this.sortable.option("disabled", this.props.disabled);
}
};

render(): JSX.Element {
const { tag, style, className, id } = this.props;
Expand Down

0 comments on commit dccdd24

Please sign in to comment.