Make YogaLayout create programmatically. Make YogaNode of YogaLayout …
Summary: Make YogaLayout constructible programmatically. Make YogaLayout's YogaNode accessible from outside. Closes https://github.com/facebook/yoga/pull/436 Differential Revision: D4850451 Pulled By: emilsjolander fbshipit-source-id: 2821a6ef4160854244c0227a3c4c96369f7b2e64
This commit is contained in:
committed by
Facebook Github Bot
parent
49e18738c3
commit
f66f52d1ba
@@ -91,15 +91,20 @@ public class YogaLayout extends ViewGroup {
|
||||
mYogaNode.setData(this);
|
||||
mYogaNode.setMeasureFunction(new ViewMeasureFunction());
|
||||
|
||||
final LayoutParams layoutParams = new LayoutParams(context, attrs);
|
||||
LayoutParams layoutParams = null;
|
||||
if (attrs != null) {
|
||||
layoutParams = new LayoutParams(context, attrs);
|
||||
} else {
|
||||
layoutParams = (LayoutParams) generateDefaultLayoutParams();
|
||||
}
|
||||
applyLayoutParams(layoutParams, mYogaNode, this);
|
||||
}
|
||||
|
||||
YogaNode getYogaNode() {
|
||||
public YogaNode getYogaNode() {
|
||||
return mYogaNode;
|
||||
}
|
||||
|
||||
YogaNode getYogaNodeForView(View view) {
|
||||
public YogaNode getYogaNodeForView(View view) {
|
||||
return mYogaNodes.get(view);
|
||||
}
|
||||
|
||||
@@ -153,8 +158,12 @@ public class YogaLayout extends ViewGroup {
|
||||
|
||||
if (child instanceof YogaLayout) {
|
||||
childNode = ((YogaLayout) child).getYogaNode();
|
||||
} else {
|
||||
if(mYogaNodes.containsKey(child)) {
|
||||
childNode = mYogaNodes.get(child);
|
||||
} else {
|
||||
childNode = new YogaNode();
|
||||
}
|
||||
|
||||
childNode.setData(child);
|
||||
childNode.setMeasureFunction(new ViewMeasureFunction());
|
||||
|
Reference in New Issue
Block a user