diff --git a/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp b/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp index 8db5fa41de131c..4b8f9a5fb7d3de 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp +++ b/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp @@ -661,6 +661,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 +756,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,