Skip to content

Commit

Permalink
feat: add more parameters to rowHeight. Fixes #199
Browse files Browse the repository at this point in the history
Added `treeIndex`, `node` and `path` to the parameters.
  • Loading branch information
wuweiweiwu authored and fritz-c committed Jan 14, 2018
1 parent a80d4cb commit 8ff0ff2
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/react-sortable-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,17 @@ class ReactSortableTree extends Component {
estimatedRowSize={
typeof rowHeight !== 'function' ? rowHeight : undefined
}
rowHeight={rowHeight}
rowHeight={
typeof rowHeight !== 'function'
? rowHeight
: ({ index }) =>
rowHeight({
index,
treeIndex: index,
node: rows[index].node,
path: rows[index].path,
})
}
rowRenderer={({ index, style: rowStyle }) =>
this.renderRow(rows[index], {
listIndex: index,
Expand All @@ -645,7 +655,12 @@ class ReactSortableTree extends Component {
height:
typeof rowHeight !== 'function'
? rowHeight
: rowHeight({ index }),
: rowHeight({
index,
treeIndex: index,
node: row.node,
path: row.path,
}),
},
getPrevRow: () => rows[index - 1] || null,
matchKeys,
Expand Down

0 comments on commit 8ff0ff2

Please sign in to comment.