Permalink
Browse files

Fixed failing snapshot test

Reviewed By: emilsjolander

Differential Revision: D6901242

fbshipit-source-id: 7391d6a34fa28e9f92f4ff834755a89dd876fdad
  • Loading branch information...
priteshrnandgaonkar authored and facebook-github-bot committed Feb 6, 2018
1 parent 114c258 commit 9658d9f82ba536c2f39937d61b3954e3dcc6a54e
Showing with 8 additions and 5 deletions.
  1. +8 −5 ReactCommon/yoga/yoga/Yoga.cpp
@@ -1705,7 +1705,7 @@ static YGCollectFlexItemsRowValues YGCalculateCollectFlexItemsRowValues(
// of the flex items abide the min and max constraints. At the end of this
// function the child nodes would have proper size. Prior using this function
// please ensure that YGDistributeFreeSpaceFirstPass is called.
static void YGDistributeFreeSpaceSecondPass(
static float YGDistributeFreeSpaceSecondPass(
YGCollectFlexItemsRowValues& collectedFlexItemsValues,
const YGNodeRef node,
const YGFlexDirection mainAxis,
@@ -1774,7 +1774,7 @@ static void YGDistributeFreeSpaceSecondPass(
}
}
deltaFreeSpace -= updatedMainSize - childFlexBasis;
deltaFreeSpace += updatedMainSize - childFlexBasis;
const float marginMain = YGNodeMarginForAxis(
currentRelativeChild, mainAxis, availableInnerWidth);
@@ -1878,8 +1878,7 @@ static void YGDistributeFreeSpaceSecondPass(
node->getLayout().hadOverflow |
currentRelativeChild->getLayout().hadOverflow);
}
collectedFlexItemsValues.remainingFreeSpace += deltaFreeSpace;
return deltaFreeSpace;
}
// It distributes the free space to the flexible items.For those flexible items
@@ -2002,6 +2001,7 @@ static void YGResolveFlexibleLength(
const YGMeasureMode measureModeCrossDim,
const bool performLayout,
const YGConfigRef config) {
const float originalFreeSpace = collectedFlexItemsValues.remainingFreeSpace;
// First pass: detect the flex items whose min/max constraints trigger
YGDistributeFreeSpaceFirstPass(
collectedFlexItemsValues,
@@ -2011,7 +2011,7 @@ static void YGResolveFlexibleLength(
availableInnerWidth);
// Second pass: resolve the sizes of the flexible items
YGDistributeFreeSpaceSecondPass(
const float distributedFreeSpace = YGDistributeFreeSpaceSecondPass(
collectedFlexItemsValues,
node,
mainAxis,
@@ -2025,6 +2025,9 @@ static void YGResolveFlexibleLength(
measureModeCrossDim,
performLayout,
config);
collectedFlexItemsValues.remainingFreeSpace =
originalFreeSpace - distributedFreeSpace;
}
//

0 comments on commit 9658d9f

Please sign in to comment.