react-complex-tree icon indicating copy to clipboard operation
react-complex-tree copied to clipboard

Animation when node is opened and closed

Open piszczu4 opened this issue 9 months ago • 2 comments

Is it possible to add a custom animation to the node content when its opened and closed?

piszczu4 avatar Nov 15 '23 02:11 piszczu4

Opening transitions should be doable fairly easily, when a subtree is opened, its content is rendered in and you should be able to just add an animation to that with CSS.

Closing animations are probably quite a bit trickier, I'm not sure if that is possible since the subtree is directly unloaded when you close the subtree, so a CSS animation is probably not working then.

lukasbach avatar Nov 27 '23 16:11 lukasbach

Is there any quick example for the animation? I think it would help a lot to implement in tree open/close folders.

Nishchit14 avatar Dec 05 '23 14:12 Nishchit14

Since this came up in another issue, I've added a prop shouldRenderChildren to allow library consumers to also show a subtree content when it is already collapsed, to allow for rendering a collapse animation. Alongside that, I also implemented a sample implementation for expanding and collapsing animations. See Demo and Demo Implementation for details.

lukasbach avatar Mar 02 '24 22:03 lukasbach