From e5f682eccad5b7f5a8bcd65ae59ac602af691000 Mon Sep 17 00:00:00 2001 From: James Ide Date: Tue, 1 Dec 2026 19:52:58 -0800 Subject: [PATCH] Correct the default errata in the `YGConfigSetErrata` comment (#2141) Differential Revision: https://www.internalfb.com/diff/D135541201 Summary: Why === The comment on `YGConfigSetErrata` in `yoga/YGConfig.h` says "By default Yoga will prioritize W3C conformance". A new config has had `YGErrataMinSizeUndefinedInsteadOfAuto` set since #1968 and `YGErrataFlexFirstPassUsesRunningTotals` since #2021 (`errata_` in `yoga/config/Config.h`), so a reader who wants conformant layout and trusts the comment does not clear them. #2116 corrected the same statement on the website's configuring page. How === The comment now says that a new config has some errata set and where to find them, without listing them: two open changes each add another default erratum, and a list here would go stale as the old sentence did. It also says that `YGConfigSetErrata` replaces the whole set. The old example, `YGConfigSetErrata(config, YGErrataStretchFlexBasis)`, reads as adding one erratum but clears the defaults, so the new example combines the erratum with `YGConfigGetErrata(config)`. Test Plan ========= A comment-only change: `cmake --build tests/build` compiles and `yarn format-check` passes. No image: there is no layout or structure to show. Changelog: [Internal] Signed-off-by: James Ide --- packages/react-native/ReactCommon/yoga/yoga/YGConfig.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/react-native/ReactCommon/yoga/yoga/YGConfig.h b/packages/react-native/ReactCommon/yoga/yoga/YGConfig.h index 215eab6da513..9baec2891123 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/YGConfig.h +++ b/packages/react-native/ReactCommon/yoga/yoga/YGConfig.h @@ -79,8 +79,14 @@ YG_EXPORT float YGConfigGetPointScaleFactor(YGConfigConstRef config); * Configures how Yoga balances W3C conformance vs compatibility with layouts * created against earlier versions of Yoga. * - * By default Yoga will prioritize W3C conformance. `Errata` may be set to ask - * Yoga to produce specific incorrect behaviors. E.g. `YGConfigSetErrata(config, + * A new config sets a few errata, each of which keeps layouts as they were + * before the fix it names; otherwise Yoga prioritizes W3C conformance. + * `YGConfigGetErrata` returns them, and the "Configuring Yoga" page of the + * documentation lists them. + * + * `YGConfigSetErrata` replaces the whole set. `YGConfigSetErrata(config, + * YGErrataNone)` clears every erratum. To add one, combine it with the current + * set: `YGConfigSetErrata(config, YGConfigGetErrata(config) | * YGErrataStretchFlexBasis)`. * * YGErrata is a bitmask, and multiple errata may be set at once. Predefined