Pass the parent size to YGNodeCalculateLayout instead of the node size

Reviewed By: astreet

Differential Revision: D4611417

fbshipit-source-id: 2fb0eedffa17f0ec89b601722a1717a72e216b9e
This commit is contained in:
Emil Sjolander
2017-02-28 08:10:34 -08:00
committed by Facebook Github Bot
parent f52d66c311
commit 702564fb60
3 changed files with 32 additions and 24 deletions

View File

@@ -33,6 +33,16 @@
float availableWidth = _availableSize.width == INFINITY ? YGUndefined : _availableSize.width;
float availableHeight = _availableSize.height == INFINITY ? YGUndefined : _availableSize.height;
YGUnit widthUnit = YGNodeStyleGetWidth(self.yogaNode).unit;
if (widthUnit == YGUnitUndefined || widthUnit == YGUnitAuto) {
YGNodeStyleSetWidthPercent(self.yogaNode, 100);
}
YGUnit heightUnit = YGNodeStyleGetHeight(self.yogaNode).unit;
if (heightUnit == YGUnitUndefined || heightUnit == YGUnitAuto) {
YGNodeStyleSetHeightPercent(self.yogaNode, 100);
}
YGNodeCalculateLayout(self.yogaNode, availableWidth, availableHeight, _baseDirection);
NSMutableSet<RCTShadowView *> *viewsWithNewFrame = [NSMutableSet set];

View File

@@ -242,6 +242,9 @@ static void RCTProcessMetaPropsBorder(const YGValue metaProps[META_PROP_COUNT],
hidden:(BOOL)hidden
absolutePosition:(CGPoint)absolutePosition
{
// This is not the core layout method. It is only used by RCTShadowText to layout
// nested views.
if (_hidden != hidden) {
// The hidden state has changed. Even if the frame hasn't changed, add
// this ShadowView to viewsWithNewFrame so the UIManager will process