diff --git a/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp b/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp index 40a37bc754b..1932ff5508b 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp +++ b/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp @@ -1316,6 +1316,10 @@ 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, @@ -1366,9 +1370,6 @@ 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);