Extra log for case where availableHeight is undefined and sizing mode != max content (#45965)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45965

X-link: https://github.com/facebook/yoga/pull/1687

We are seeing some crashes that are hard to wrap our head around. Lets add more logs. I chose these values based on what could make the height/width undefined from looking at the code. We might need more but this should give us some more direction.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D61054392

fbshipit-source-id: 654ff96f94aa89605a603e2e36335bb48b61f4a2
This commit is contained in:
Joe Vilches
2024-08-19 16:13:44 -07:00
committed by Facebook GitHub Bot
parent 0f3ed90455
commit 7027eac09a
@@ -10,6 +10,7 @@
#include <cfloat>
#include <cmath>
#include <cstring>
#include <string>
#include <yoga/Yoga.h>
@@ -661,6 +662,13 @@ static float distributeFreeSpaceSecondPass(
}
}
yoga::assertFatalWithNode(
currentLineChild,
yoga::isDefined(updatedMainSize),
("updatedMainSize is undefined. mainAxisownerSize: " +
std::to_string(mainAxisownerSize))
.c_str());
deltaFreeSpace += updatedMainSize - childFlexBasis;
const float marginMain = currentLineChild->style().computeMarginForAxis(
@@ -749,6 +757,20 @@ static float distributeFreeSpaceSecondPass(
const bool isLayoutPass = performLayout && !requiresStretchLayout;
// Recursively call the layout algorithm for this child with the updated
// main size.
yoga::assertFatalWithNode(
currentLineChild,
yoga::isUndefined(childMainSize)
? childMainSizingMode == SizingMode::MaxContent
: true,
"childMainSize is undefined so childMainSizingMode must be MaxContent");
yoga::assertFatalWithNode(
currentLineChild,
yoga::isUndefined(childCrossSize)
? childCrossSizingMode == SizingMode::MaxContent
: true,
"childCrossSize is undefined so childCrossSizingMode must be MaxContent");
calculateLayoutInternal(
currentLineChild,
childWidth,