From 9213f889ef9497f145e3b6362ebfcdfe7a36464e Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Thu, 27 Apr 2023 09:56:14 -0700 Subject: [PATCH] Replace usages of YGConfigSetUseLegacyStretchBehaviour (#37093) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37093 This replaces product usages of `YGConfigSetUseLegacyStretchBehaviour` with instead setting `YGErrataAll`, to opt out of future conformance fixes which may impact compatibility. We need to still audit C/C++ usage for where we should be applying `YGErrataClassic`, port this change to the RN desktop fork, then mark the function as deprecated (taking care to allow deprecated functions in the Yoga bindings to call deprecated C ABI functions without warning). Changelog: [Internal] Reviewed By: yungsters Differential Revision: D45300631 fbshipit-source-id: dbe8c82b3de677b9788878dc2b4fa2aaccabe156 --- packages/react-native/React/Views/RCTShadowView.m | 2 +- .../react/renderer/components/view/YogaLayoutableShadowNode.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native/React/Views/RCTShadowView.m b/packages/react-native/React/Views/RCTShadowView.m index baca3cef65e4bf..7f8a47a22c9828 100644 --- a/packages/react-native/React/Views/RCTShadowView.m +++ b/packages/react-native/React/Views/RCTShadowView.m @@ -50,7 +50,7 @@ + (YGConfigRef)yogaConfig dispatch_once(&onceToken, ^{ yogaConfig = YGConfigNew(); YGConfigSetPointScaleFactor(yogaConfig, RCTScreenScale()); - YGConfigSetUseLegacyStretchBehaviour(yogaConfig, true); + YGConfigSetErrata(yogaConfig, YGErrataAll); }); return yogaConfig; } 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 8858a29b718cc0..75e6c1b15ee66a 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp @@ -745,7 +745,7 @@ YogaLayoutableShadowNode &YogaLayoutableShadowNode::shadowNodeFromContext( YGConfig &YogaLayoutableShadowNode::initializeYogaConfig(YGConfig &config) { YGConfigSetCloneNodeFunc( &config, YogaLayoutableShadowNode::yogaNodeCloneCallbackConnector); - YGConfigSetUseLegacyStretchBehaviour(&config, true); + YGConfigSetErrata(&config, YGErrataAll); #ifdef RN_DEBUG_YOGA_LOGGER YGConfigSetPrintTreeFlag(&config, true); #endif