frontend-collective / react-sortable-tree

Drag-and-drop sortable component for nested data and hierarchies
https://frontend-collective.github.io/react-sortable-tree/
MIT License
4.9k stars 897 forks source link

Height required.. how to enable variable height #905

Open rchancey opened 3 years ago

rchancey commented 3 years ago

I reported a bug recently and I resolved it by setting the height.. heck even in all the examples it is given a fixed height :-(.

The issue is I need the height of the container to grow with the tree. Is there a way I can set the height, which is required for the tree to even show, but also have it grow?

rt-bear commented 2 years ago

I have the same problem,have you solved it?

SilverFoxA commented 1 year ago

The code here containerStyle = { height: '100%', ...containerStyle }; could have been a bit more flexible.

https://github.com/frontend-collective/react-sortable-tree/blame/f482bc7f2853c698cad08fc75bb6fd3e36f2f79a/src/react-sortable-tree.js#L685

You can use the style property on the sortable widget to give a dynamic height to your list.

<SortableTree style={{ height: this.getHeight() }} />