From 4be96072900c1040f5a3943c33b4bae63a44a813 Mon Sep 17 00:00:00 2001 From: Joe Vilches Date: Thu, 30 Nov 2023 16:40:46 -0800 Subject: [PATCH] Change comment on Yoga measure modes in RN (#41732) Summary: Was reading the code in this file and noticed that this comment is no longer true after D51068417 (https://github.com/facebook/yoga/pull/1460). Updated the comment to reflect the current state of things Changelog: [Internal] Reviewed By: NickGerleman Differential Revision: D51730986 --- .../components/view/YogaLayoutableShadowNode.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp b/packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp index d828c84b08cd49..7757bd6695dbf6 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp @@ -604,13 +604,11 @@ void YogaLayoutableShadowNode::layoutTree( react_native_assert(!std::isinf(minimumSize.width)); react_native_assert(!std::isinf(minimumSize.height)); - // Internally Yoga uses three different measurement modes controlling layout - // constraints: `Undefined`, `Exactly`, and `AtMost`. These modes are an - // implementation detail and are not defined in `CSS Flexible Box Layout - // Module`. Yoga C++ API (and `YGNodeCalculateLayout` function particularly) - // does not allow to specify the measure modes explicitly. Instead, it infers - // these from styles associated with the root node. - // To pass the actual layout constraints to Yoga we represent them as + // Yoga C++ API (and `YGNodeCalculateLayout` function particularly) + // does not allow to specify sizing modes (see + // https://www.w3.org/TR/css-sizing-3/#auto-box-sizes) explicitly. Instead, it + // infers these from styles associated with the root node. To pass the actual + // layout constraints to Yoga we represent them as // `(min/max)(Height/Width)` style properties. Also, we pass `ownerWidth` & // `ownerHeight` to allow proper calculation of relative (e.g. specified in // percents) style values.