From 495fb5405845074166a4cb0e78b2339232fbbd8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20W=C3=B6hrl?= Date: Fri, 3 Mar 2017 10:31:47 -0800 Subject: [PATCH] Mark all children as dirty if display changes Summary: If we set ```display:none``` all children are set with layout sizes/values of 0. We need do mark all those children as dirty to force a relayout if we toggle the display on a higher parent node. This fixes #443 Closes https://github.com/facebook/yoga/pull/448 Reviewed By: astreet Differential Revision: D4642273 Pulled By: emilsjolander fbshipit-source-id: dfdb920e2049952bd6c7f48cfa53b1448e1f3e8f --- ReactCommon/yoga/yoga/Yoga.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ReactCommon/yoga/yoga/Yoga.c b/ReactCommon/yoga/yoga/Yoga.c index 51838d87e..d4743518d 100644 --- a/ReactCommon/yoga/yoga/Yoga.c +++ b/ReactCommon/yoga/yoga/Yoga.c @@ -1791,6 +1791,12 @@ static void YGZeroOutLayoutRecursivly(const YGNodeRef node) { node->layout.position[YGEdgeBottom] = 0; node->layout.position[YGEdgeLeft] = 0; node->layout.position[YGEdgeRight] = 0; + node->layout.cachedLayout.availableHeight = 0; + node->layout.cachedLayout.availableWidth = 0; + node->layout.cachedLayout.heightMeasureMode = YGMeasureModeExactly; + node->layout.cachedLayout.widthMeasureMode = YGMeasureModeExactly; + node->layout.cachedLayout.computedWidth = 0; + node->layout.cachedLayout.computedHeight = 0; const uint32_t childCount = YGNodeGetChildCount(node); for (uint32_t i = 0; i < childCount; i++) { const YGNodeRef child = YGNodeListGet(node->children, i);