frontend-collective / frontend-collective/react-sortable-tree

Need Help with Custom Theme - How to access generatedNodeProps from within treeNodeRenderer?

Open
#880 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5k
Forks
914
PR merge metrics
No merged PRs in 30d

Description

Im writing a custom theme for my work. Its working well so far. But I was wondering if theres a way to access the generatedNodeProps from the treeNodeRenderer. To be clear, I know how youre supposed to do it. The generatedNodeProps seem to be exposed to the components through deconstructing ...otherProps. But this only works in the node-content-renderer file not the tree-node-renderer. It seems that the generatedNodeProps does not actually get passed to the tree-node-renderer. From looking at the source code im pretty sure I could fix this myself by messing with the source files. But it would obviusly be preferable if there was a more streamlined solution.

In reality what I want to be able to do is to execute the insertNode Data Helper Function from within tree-node-renderer. But to be able to do that I need to be able to access the treedata from within the tree-node-rederer. It doesnt seem like treeData is passed there at all. And I cant pass it myself because generatedNodeProps also isnt passed.

In other words, my problem can be fixed in multiple ways. I need to be able to access either the treeData or the generatedNodeProps, or I need to be able to trigger a Data Helper Function outside of tree-node-renderer somehow, and just pass it some data.

This is the first time Im developing in react, coming mainly from a vue.js background so there might be some react solutions I might not even have thought about. I suspect however that there might not actually be a way to access any of this from inside the tree-node-renderer. In which case I might have to either get the desired feature working some other way(I have a few ideas) or I might just decide to fork the source code and implement the passing of the treeData object to tree-node-renderer myself.

Anyway. Thanks for any help. Sorry for the long post. Ill post some quick screenshots to let you guys get a quick glance at what im working with.

![Screenshot (5)_LI](https://user-images.githubusercontent.com/12764398/113484052-a9d93b00-94a6-11eb-815d-906eac6609dc.jpg)
![Screenshot (2)_LI](https://user-images.githubusercontent.com/12764398/113484061-b2317600-94a6-11eb-9c9b-8d2e955d3b52.jpg)
![Screenshot (3)_LI](https://user-images.githubusercontent.com/12764398/113484066-b52c6680-94a6-11eb-8bb2-eb1826fe61de.jpg)
![Screenshot (4)_LI](https://user-images.githubusercontent.com/12764398/113484070-b9588400-94a6-11eb-97c6-c5199ccf5ccb.jpg)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.