Skip to content

Commit

Permalink
fix: rename parentNode callback param to nextParentNode
Browse files Browse the repository at this point in the history
  • Loading branch information
fritz-c committed Jan 21, 2018
1 parent 3ec2329 commit 24bf39d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ treeData<br/>_(required)_ | object[] | Tree data with the following keys:
onChange<br/>_(required)_ | func | Called whenever tree data changed. Just like with React input elements, you have to update your own component's data to see the changes reflected.<div>`( treeData: object[] ): void`</div>
getNodeKey<br/>_(recommended)_ | func | Specify the unique key used to identify each node and generate the `path` array passed in callbacks. It uses [`defaultGetNodeKey`](https://github.com/fritz-c/react-sortable-tree/blob/master/src/utils/default-handlers.js) by default, which returns the index in the tree (omitting hidden nodes).<div>`({ node: object, treeIndex: number }): string or number`</div>
generateNodeProps | func | Generate an object with additional props to be passed to the node renderer. Use this for adding buttons via the `buttons` key, or additional `style` / `className` settings.<div>`({ node: object, path: number[] or string[], treeIndex: number, lowerSiblingCounts: number[], isSearchMatch: bool, isSearchFocus: bool }): object`</div>
onMoveNode | func | Called after node move operation. <div>`({ treeData: object[], node: object, parentNode: object, prevPath: number[] or string[], prevTreeIndex: number, nextPath: number[] or string[], nextTreeIndex: number }): void`</div>
onMoveNode | func | Called after node move operation. <div>`({ treeData: object[], node: object, nextParentNode: object, prevPath: number[] or string[], prevTreeIndex: number, nextPath: number[] or string[], nextTreeIndex: number }): void`</div>
onVisibilityToggle | func | Called after children nodes collapsed or expanded. <div>`({ treeData: object[], node: object, expanded: bool, path: number[] or string[] }): void`</div>
onDragStateChanged | func | Called when a drag is initiated or ended. <div>`({ isDragging: bool, draggedNode: object }): void`</div>
maxDepth | number | Maximum depth nodes can be inserted at. Defaults to infinite.
Expand Down
9 changes: 7 additions & 2 deletions src/react-sortable-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,12 @@ class ReactSortableTree extends Component {
depth,
minimumTreeIndex,
}) {
const { treeData, treeIndex, path, parentNode } = insertNode({
const {
treeData,
treeIndex,
path,
parentNode: nextParentNode,
} = insertNode({
treeData: this.state.draggingTreeData,
newNode: node,
depth,
Expand All @@ -239,7 +244,7 @@ class ReactSortableTree extends Component {
nextTreeIndex: treeIndex,
prevPath,
prevTreeIndex,
parentNode,
nextParentNode,
});
}

Expand Down

0 comments on commit 24bf39d

Please sign in to comment.