Skip to content

Commit

Permalink
Merge pull request #44 from JakeSidSmith/shared-props
Browse files Browse the repository at this point in the history
Pass sharedProps to each item & update readme
  • Loading branch information
JakeSidSmith committed Jan 30, 2015
2 parents 7b680d1 + d486bd4 commit e174421
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ __[Demo](http://jakesidsmith.github.io/react-reorderable/)__
// Class to be applied to each list item's wrapper element
itemClass='list-item',
// A function to be called if a list item is clicked (before hold time is up)
itemClicked={this.itemClicked} />
itemClicked={this.itemClicked}
// The item to be selected (adds 'selected' class)
selected={this.state.selected}
// The key to compare from the selected item object with each item object
selectedKey='uuid'
// Allows reordering to be disabled
disableReorder={false}/>
```

2. Using standard Javascript
Expand Down Expand Up @@ -98,7 +104,13 @@ __[Demo](http://jakesidsmith.github.io/react-reorderable/)__
// Class to be applied to each list item's wrapper element
itemClass: 'list-item',
// A function to be called if a list item is clicked (before hold time is up)
itemClicked: this.itemClicked})
itemClicked: this.itemClicked
// The item to be selected (adds 'selected' class)
selected: this.state.selected
// The key to compare from the selected item object with each item object
selectedKey: 'uuid'
// Allows reordering to be disabled
disableReorder: false})
```

5. Callback functions
Expand Down
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.2.1",
"version": "1.3.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.2.1",
"version": "1.3.0",
"description": "Drag & drop, touch enabled, reorderable / sortable list, React component",
"author": "Jake 'Sid' Smith",
"license": "MIT",
Expand Down
5 changes: 4 additions & 1 deletion reorderable.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,10 @@

var getPropsTemplate = function (item) {
if (self.props.template) {
return React.createElement(self.props.template, {item: item});
return React.createElement(self.props.template, {
item: item,
sharedProps: self.props.sharedProps
});
}
return item;
};
Expand Down

0 comments on commit e174421

Please sign in to comment.