AnyRoad / react-json-view-lite

Lightweight Json view component for React
155 stars 14 forks source link

`onNodeExpanded` and `onNodeCollapsed` props #17

Open ryanteamflow opened 10 months ago

ryanteamflow commented 10 months ago

Hi, thanks for this great library! I was wondering if you were accepting PRs. I have a need for a JSON viewer that allows persisting the collapse/expansion state and yours seems best suited for it since you have the super useful shouldExpandNode prop that other libraries are missing. Only problem is I don't have a way right now to keep track of those expansion changes as they happen. I have a branch on a fork that implements a basic setup for this using simple onNodeExpanded and onNodeCollapsed callback props. Is this something you would find useful to your other users as well?

Commit on my fork:

https://github.com/ryanteamflow/react-json-view-lite/commit/b913ed0ef404a00ce0141397f6a013c061bea559

ryanteamflow commented 10 months ago

oops forgot you can't share fork repos publicly, I'll just go ahead and open a PR but feel free to close if it's not something you're interested in. Thanks!

ryanteamflow commented 10 months ago

https://github.com/AnyRoad/react-json-view-lite/pull/18