Skip to content

Commit 8ff0ff2

Browse files
wuweiweiwufritz-c
authored andcommittedJan 14, 2018
feat: add more parameters to rowHeight. Fixes #199
Added `treeIndex`, `node` and `path` to the parameters.
1 parent a80d4cb commit 8ff0ff2

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed
 

Diff for: ‎src/react-sortable-tree.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,17 @@ class ReactSortableTree extends Component {
619619
estimatedRowSize={
620620
typeof rowHeight !== 'function' ? rowHeight : undefined
621621
}
622-
rowHeight={rowHeight}
622+
rowHeight={
623+
typeof rowHeight !== 'function'
624+
? rowHeight
625+
: ({ index }) =>
626+
rowHeight({
627+
index,
628+
treeIndex: index,
629+
node: rows[index].node,
630+
path: rows[index].path,
631+
})
632+
}
623633
rowRenderer={({ index, style: rowStyle }) =>
624634
this.renderRow(rows[index], {
625635
listIndex: index,
@@ -645,7 +655,12 @@ class ReactSortableTree extends Component {
645655
height:
646656
typeof rowHeight !== 'function'
647657
? rowHeight
648-
: rowHeight({ index }),
658+
: rowHeight({
659+
index,
660+
treeIndex: index,
661+
node: row.node,
662+
path: row.path,
663+
}),
649664
},
650665
getPrevRow: () => rows[index - 1] || null,
651666
matchKeys,

0 commit comments

Comments
 (0)