diff --git a/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp b/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp index 54d03e11371755..ef3544de0f53f0 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp +++ b/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp @@ -1294,10 +1294,6 @@ static void calculateLayoutImpl( flexColumnDirection, direction, ownerWidth), PhysicalEdge::Bottom); - // Clean and update all display: contents nodes with a direct path to the - // current node as they will not be traversed - cleanupContentsNodesRecursively(node); - if (node->hasMeasureFunc()) { measureNodeWithMeasureFunc( node, @@ -1310,6 +1306,10 @@ static void calculateLayoutImpl( ownerHeight, layoutMarkerData, reason); + + // Clean and update all display: contents nodes with a direct path to the + // current node as they will not be traversed + cleanupContentsNodesRecursively(node); return; } @@ -1324,6 +1324,10 @@ static void calculateLayoutImpl( heightSizingMode, ownerWidth, ownerHeight); + + // Clean and update all display: contents nodes with a direct path to the + // current node as they will not be traversed + cleanupContentsNodesRecursively(node); return; } @@ -1339,6 +1343,9 @@ static void calculateLayoutImpl( heightSizingMode, ownerWidth, ownerHeight)) { + // Clean and update all display: contents nodes with a direct path to the + // current node as they will not be traversed + cleanupContentsNodesRecursively(node); return; } @@ -1348,6 +1355,10 @@ static void calculateLayoutImpl( // Reset layout flags, as they could have changed. node->setLayoutHadOverflow(false); + // Clean and update all display: contents nodes with a direct path to the + // current node as they will not be traversed + cleanupContentsNodesRecursively(node); + // STEP 1: CALCULATE VALUES FOR REMAINDER OF ALGORITHM const FlexDirection mainAxis = resolveDirection(node->style().flexDirection(), direction);