From f0901176e0138515e3b785452b8a26d923f4c31b Mon Sep 17 00:00:00 2001 From: Aaron Lipinski Date: Wed, 5 Oct 2016 17:12:57 +1300 Subject: [PATCH] support changable collection --- src/SortableElement/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/SortableElement/index.js b/src/SortableElement/index.js index 3a0157f70..13bf3e4cd 100644 --- a/src/SortableElement/index.js +++ b/src/SortableElement/index.js @@ -41,6 +41,10 @@ export default function SortableElement (WrappedComponent, config = {withRef: fa this.setDraggable(collection, index); } } + else if (this.props.collection !== nextProps.collection) { + this.removeDraggable(this.props.collection); + this.setDraggable(nextProps.collection, nextProps.index); + } } componentWillUnmount() { let {collection, disabled} = this.props;