Dynamic stringer list item
nervo opened this issue · 0 comments
nervo commented
In upcoming list component, i've noticed that you can add items of any type.
There is a switch in Tree.Child
method to handle this properly (see:
Line 133 in 33b3263
In cases of simple custom application items, one can choose between two options:
- implement
Node
interface (see:Line 36 in 33b3263
Value
,Children
andHidden
methods, even if you don't really need them - implement go
Stringer
interface, which, in this case, is converted to aLeaf
(see:Line 148 in 33b3263
I think the Leaf
struct should keep the Stringer
as a property, and call its String()
method during the render time, via its Value()
method.
This way, it will become totally dynamic, and give the option to change its value during the item lifetime.
And if you're ok with that, i can make a pull request :)