Four modifications (sorry, should've made four PRs)
-
Selection-change callbacks are now made outside of the setState hook. They were previously being called from within a setState Dispatch function, which (I think) meant that if the callback code modifies other app state, this causes a "cannot update a component while rendering another component" error. I had logged this as an issue earlier (https://github.com/naisutech/react-tree/issues/68), but my first proposed solution used useEffect hooks, whereas this PR'd code doesn't.
-
I was working on Windows for a bit this week, so added some Windows-specific yarn scripts.
-
IconRenderer function can now return null to use default icon behaviour. My own use case for this was that I liked the arrow for the Nodes, so only wanted to replace the Leaf icons.
-
The
animationsprop controlled the "cascading" animation of the dropdown lists, but not the animation of the rotating arrow or the fade-in of the leaf selection color. This was clashing with the non-animated lists etc on my app, so I created a prop calledanimateSelectionto control these (default=true), and renamed the other one toanimateDropdown(default=false) though the legacyanimationsprop should still work.
Hi, thanks for this. Not ignoring it. Just been very very busy. Will get back in next few weeks.