Skip to content

Commit dccdd24

Browse files
committed
fix: allow update disabled prop at runtime
1 parent a104520 commit dccdd24

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/react-sortable.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
7171
const newOptions = this.makeOptions();
7272
Sortable.create(this.ref.current, newOptions);
7373
}
74+
componentDidUpdate(prevProps: ReactSortableProps<T>): void {
75+
if (prevProps.disabled !== this.props.disabled && this.sortable) {
76+
this.sortable.option("disabled", this.props.disabled);
77+
}
78+
};
7479

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

0 commit comments

Comments
 (0)