You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Within YGNodeInsertChild() we assert that the child we are adding cannot already have an owner. At the same time, within YGNodeRemoveChild() we have a comment indicating that "Children may be shared between parents". These two statements seem contradictory to me - is there a logical error here or am I interpreting the assert/comments incorrectly? Under what circumstances could we expect a node to wind up with multiple owners/parents?
The text was updated successfully, but these errors were encountered:
Under what circumstances could we expect a node to wind up with multiple owners/parents?
My understanding is that multiple owners are (or were?) being used within React Native for copy-on-write trees that share subtrees. Thus, a node should only have a single owner within the same tree (descending from a particular root node), but it may be in multiple trees. Unless you really need this functionality I would recommend enforcing that nodes only have a single owner in your own use of Yoga.
Yes, the public API does not allow multiple owners. RN Fabric uses concrete (private) Yoga node implementation, and ends up bypassing this check. I suspect some of these changes might have been made without as much awareness of the layering here.
I do want to find a way to get RN Fabric onto public Yoga API. There is a world where we make a revised Yoga API, to try to allow more client flexibility (in some other ways as well). Or possibly a world where we relax more of the public API constraints to make it possible, but it's not entirely clean.
Report
Within YGNodeInsertChild() we assert that the child we are adding cannot already have an owner. At the same time, within YGNodeRemoveChild() we have a comment indicating that "Children may be shared between parents". These two statements seem contradictory to me - is there a logical error here or am I interpreting the assert/comments incorrectly? Under what circumstances could we expect a node to wind up with multiple owners/parents?
The text was updated successfully, but these errors were encountered: