Pass parent with down with calculateLayout to allow percentages on root node
Summary: For percentage paddings/margins/sizes to work on the root node we need to have the ability to pass down the parent sizes. This has always been possible with the C API but was never exposed to java. This diff exposes this functionality. Reviewed By: astreet Differential Revision: D4501016 fbshipit-source-id: 0c9502e86ff200c021c78afb7ac4b48cf11b3bdb
This commit is contained in:
committed by
Facebook Github Bot
parent
93e327f4a5
commit
56d06e27cf
@@ -48,7 +48,7 @@ public class YGAlignContentTest {
|
||||
root_child4.setHeight(10f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout();
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
@@ -81,7 +81,7 @@ public class YGAlignContentTest {
|
||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout();
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
@@ -147,7 +147,7 @@ public class YGAlignContentTest {
|
||||
root_child4.setHeight(10f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout();
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
@@ -180,7 +180,7 @@ public class YGAlignContentTest {
|
||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout();
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
@@ -246,7 +246,7 @@ public class YGAlignContentTest {
|
||||
root_child4.setHeight(10f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout();
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
@@ -279,7 +279,7 @@ public class YGAlignContentTest {
|
||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout();
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
@@ -340,7 +340,7 @@ public class YGAlignContentTest {
|
||||
root_child4.setWidth(50f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout();
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
@@ -373,7 +373,7 @@ public class YGAlignContentTest {
|
||||
assertEquals(0f, root_child4.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout();
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
|
Reference in New Issue
Block a user