Skip to content

Commit e174421

Browse files
committed
Merge pull request #44 from JakeSidSmith/shared-props
Pass sharedProps to each item & update readme
2 parents 7b680d1 + d486bd4 commit e174421

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,13 @@ __[Demo](http://jakesidsmith.github.io/react-reorderable/)__
7070
// Class to be applied to each list item's wrapper element
7171
itemClass='list-item',
7272
// A function to be called if a list item is clicked (before hold time is up)
73-
itemClicked={this.itemClicked} />
73+
itemClicked={this.itemClicked}
74+
// The item to be selected (adds 'selected' class)
75+
selected={this.state.selected}
76+
// The key to compare from the selected item object with each item object
77+
selectedKey='uuid'
78+
// Allows reordering to be disabled
79+
disableReorder={false}/>
7480
```
7581

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

104116
5. Callback functions

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-reorderable",
3-
"version": "1.2.1",
3+
"version": "1.3.0",
44
"description": "Drag & drop, touch enabled, reorderable / sortable list, React component",
55
"homepage": "https://github.com/JakeSidSmith/react-reorderable",
66
"license": "MIT",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-reorderable",
3-
"version": "1.2.1",
3+
"version": "1.3.0",
44
"description": "Drag & drop, touch enabled, reorderable / sortable list, React component",
55
"author": "Jake 'Sid' Smith",
66
"license": "MIT",

reorderable.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,10 @@
459459

460460
var getPropsTemplate = function (item) {
461461
if (self.props.template) {
462-
return React.createElement(self.props.template, {item: item});
462+
return React.createElement(self.props.template, {
463+
item: item,
464+
sharedProps: self.props.sharedProps
465+
});
463466
}
464467
return item;
465468
};

0 commit comments

Comments
 (0)