Add methods for easy adding/removing children

Summary:
Adds two methods ```AddChild``` and ```RemoveChild``` to be able to add/remove children without the need to know there position.
Closes https://github.com/facebook/yoga/pull/513

Reviewed By: emilsjolander

Differential Revision: D4914242

Pulled By: splhack

fbshipit-source-id: df187ba71a1bae0b3b0649624f3c29401d5f8804
This commit is contained in:
Lukas Wöhrl
2017-04-19 11:19:45 -07:00
committed by Facebook Github Bot
parent 8891ea1a7a
commit 8b0ff0a25c

View File

@@ -576,6 +576,20 @@ namespace Facebook.Yoga
Native.YGNodeRemoveChild(_ygNode, child._ygNode);
}
public void AddChild(YogaNode child)
{
Insert(Count, child);
}
public void RemoveChild(YogaNode child)
{
int index = IndexOf(child);
if (index >= 0)
{
RemoveAt(IndexOf(child));
}
}
public void Clear()
{
if (_children != null)