Skip to content

Commit

Permalink
Disable reordering
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeSidSmith committed Jan 27, 2015
1 parent 50d3afc commit ddc6152
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-reorderable",
"version": "1.0.3",
"version": "1.1.0",
"description": "Drag & drop, touch enabled, reorderable / sortable list, React component",
"homepage": "https://github.com/JakeSidSmith/react-reorderable",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-reorderable",
"version": "1.0.3",
"version": "1.1.0",
"description": "Drag & drop, touch enabled, reorderable / sortable list, React component",
"author": "Jake 'Sid' Smith",
"license": "MIT",
Expand Down
24 changes: 15 additions & 9 deletions reorderable.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
}
},
startDrag: function (dragOffset, draggedStyle) {
this.setState({
dragOffset: dragOffset,
draggedStyle: draggedStyle,
originalPosition: draggedStyle,
held: true,
moved: false
});
if (!this.props.disableReorder) {
this.setState({
dragOffset: dragOffset,
draggedStyle: draggedStyle,
originalPosition: draggedStyle,
held: true,
moved: false
});
}
},
itemDown: function (item, index, event) {
event.preventDefault();
Expand Down Expand Up @@ -434,10 +436,14 @@
},
componentWillReceiveProps: function (props) {
// Updates list when props changed
this.setState({list: props.list});
this.setState({
list: props.list
});
},
getInitialState: function () {
return {list: this.props.list || []};
return {
list: this.props.list || []
};
},
render: function () {
var self = this;
Expand Down

0 comments on commit ddc6152

Please sign in to comment.