From 2fc4d56034dd3e6c7c57e17d1132fd82f6d3ccfe Mon Sep 17 00:00:00 2001 From: William Khoe Date: Fri, 6 Mar 2026 16:24:23 -0800 Subject: [PATCH] Back out "Add fixYogaFlexBasisFitContentInMainAxis flag to avoid unnecessary re-measurement" Summary: X-link: https://github.com/facebook/yoga/pull/1911 Backing out the following pull due to bugs * https://github.com/facebook/yoga/pull/1909 * https://github.com/facebook/react-native/pull/55897 Reviewed By: sammy-SC Differential Revision: D95616085 --- .../featureflags/ReactNativeFeatureFlags.kt | 8 +- .../ReactNativeFeatureFlagsCxxAccessor.kt | 12 +- .../ReactNativeFeatureFlagsCxxInterop.kt | 4 +- .../ReactNativeFeatureFlagsDefaults.kt | 4 +- .../ReactNativeFeatureFlagsLocalAccessor.kt | 13 +- .../ReactNativeFeatureFlagsProvider.kt | 4 +- .../java/com/facebook/yoga/YogaErrata.java | 2 - .../JReactNativeFeatureFlagsCxxInterop.cpp | 16 +-- .../JReactNativeFeatureFlagsCxxInterop.h | 5 +- .../featureflags/ReactNativeFeatureFlags.cpp | 6 +- .../featureflags/ReactNativeFeatureFlags.h | 7 +- .../ReactNativeFeatureFlagsAccessor.cpp | 76 +++++------- .../ReactNativeFeatureFlagsAccessor.h | 6 +- .../ReactNativeFeatureFlagsDefaults.h | 6 +- .../ReactNativeFeatureFlagsDynamicProvider.h | 11 +- .../ReactNativeFeatureFlagsProvider.h | 3 +- .../NativeReactNativeFeatureFlags.cpp | 7 +- .../NativeReactNativeFeatureFlags.h | 4 +- .../view/YogaLayoutableShadowNode.cpp | 9 +- .../ReactCommon/yoga/yoga/YGEnums.cpp | 2 - .../ReactCommon/yoga/yoga/YGEnums.h | 1 - .../yoga/yoga/algorithm/CalculateLayout.cpp | 115 +++--------------- .../ReactCommon/yoga/yoga/enums/Errata.h | 1 - .../ReactNativeFeatureFlags.config.js | 11 -- .../ShadowNodeRevisionGetter-itest.js | 11 +- .../featureflags/ReactNativeFeatureFlags.js | 7 +- .../specs/NativeReactNativeFeatureFlags.js | 3 +- 27 files changed, 68 insertions(+), 286 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt index 4b4546cce408..b4e1546f477c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<55bcfe664afd673f0a9767468a3ca98f>> + * @generated SignedSource<> */ /** @@ -390,12 +390,6 @@ public object ReactNativeFeatureFlags { @JvmStatic public fun fixTextClippingAndroid15useBoundsForWidth(): Boolean = accessor.fixTextClippingAndroid15useBoundsForWidth() - /** - * When enabled, Yoga will not apply a FitContent constraint in the main axis during flex basis computation for non-measure container nodes. This prevents unnecessary re-measurement and cascading clones when a sibling changes size in a ScrollView. - */ - @JvmStatic - public fun fixYogaFlexBasisFitContentInMainAxis(): Boolean = accessor.fixYogaFlexBasisFitContentInMainAxis() - /** * Enable system assertion validating that Fusebox is configured with a single host. When set, the CDP backend will dynamically disable features (Perf and Network) in the event that multiple hosts are registered (undefined behaviour), and broadcast this over `ReactNativeApplication.systemStateChanged`. */ diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt index f1b8d1749b4d..a2b8a4feb509 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<5ec50a8b4d2627a478ec9633e84ab046>> + * @generated SignedSource<> */ /** @@ -80,7 +80,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces private var fixFindShadowNodeByTagRaceConditionCache: Boolean? = null private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null private var fixTextClippingAndroid15useBoundsForWidthCache: Boolean? = null - private var fixYogaFlexBasisFitContentInMainAxisCache: Boolean? = null private var fuseboxAssertSingleHostStateCache: Boolean? = null private var fuseboxEnabledReleaseCache: Boolean? = null private var fuseboxNetworkInspectionEnabledCache: Boolean? = null @@ -650,15 +649,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces return cached } - override fun fixYogaFlexBasisFitContentInMainAxis(): Boolean { - var cached = fixYogaFlexBasisFitContentInMainAxisCache - if (cached == null) { - cached = ReactNativeFeatureFlagsCxxInterop.fixYogaFlexBasisFitContentInMainAxis() - fixYogaFlexBasisFitContentInMainAxisCache = cached - } - return cached - } - override fun fuseboxAssertSingleHostState(): Boolean { var cached = fuseboxAssertSingleHostStateCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt index 60f6090b265c..285c346d0e15 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> */ /** @@ -148,8 +148,6 @@ public object ReactNativeFeatureFlagsCxxInterop { @DoNotStrip @JvmStatic public external fun fixTextClippingAndroid15useBoundsForWidth(): Boolean - @DoNotStrip @JvmStatic public external fun fixYogaFlexBasisFitContentInMainAxis(): Boolean - @DoNotStrip @JvmStatic public external fun fuseboxAssertSingleHostState(): Boolean @DoNotStrip @JvmStatic public external fun fuseboxEnabledRelease(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt index d9cdb39e914d..ab8ccda71ece 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<0e10c51dcebd6077237c0c0aaff251e8>> + * @generated SignedSource<> */ /** @@ -143,8 +143,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi override fun fixTextClippingAndroid15useBoundsForWidth(): Boolean = false - override fun fixYogaFlexBasisFitContentInMainAxis(): Boolean = false - override fun fuseboxAssertSingleHostState(): Boolean = true override fun fuseboxEnabledRelease(): Boolean = false diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt index 1b55fcc26248..1de3d747b886 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> */ /** @@ -84,7 +84,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc private var fixFindShadowNodeByTagRaceConditionCache: Boolean? = null private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null private var fixTextClippingAndroid15useBoundsForWidthCache: Boolean? = null - private var fixYogaFlexBasisFitContentInMainAxisCache: Boolean? = null private var fuseboxAssertSingleHostStateCache: Boolean? = null private var fuseboxEnabledReleaseCache: Boolean? = null private var fuseboxNetworkInspectionEnabledCache: Boolean? = null @@ -714,16 +713,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc return cached } - override fun fixYogaFlexBasisFitContentInMainAxis(): Boolean { - var cached = fixYogaFlexBasisFitContentInMainAxisCache - if (cached == null) { - cached = currentProvider.fixYogaFlexBasisFitContentInMainAxis() - accessedFeatureFlags.add("fixYogaFlexBasisFitContentInMainAxis") - fixYogaFlexBasisFitContentInMainAxisCache = cached - } - return cached - } - override fun fuseboxAssertSingleHostState(): Boolean { var cached = fuseboxAssertSingleHostStateCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt index 4f1359e3b6f3..b37e9698c04d 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<39585bb818914cc7a02e18399fe49cbe>> */ /** @@ -143,8 +143,6 @@ public interface ReactNativeFeatureFlagsProvider { @DoNotStrip public fun fixTextClippingAndroid15useBoundsForWidth(): Boolean - @DoNotStrip public fun fixYogaFlexBasisFitContentInMainAxis(): Boolean - @DoNotStrip public fun fuseboxAssertSingleHostState(): Boolean @DoNotStrip public fun fuseboxEnabledRelease(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaErrata.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaErrata.java index 3bd711beb59f..e0521b3fbb52 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaErrata.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaErrata.java @@ -14,7 +14,6 @@ public enum YogaErrata { STRETCH_FLEX_BASIS(1), ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING(2), ABSOLUTE_PERCENT_AGAINST_INNER_SIZE(4), - FLEX_BASIS_FIT_CONTENT_IN_MAIN_AXIS(8), ALL(2147483647), CLASSIC(2147483646); @@ -34,7 +33,6 @@ public static YogaErrata fromInt(int value) { case 1: return STRETCH_FLEX_BASIS; case 2: return ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING; case 4: return ABSOLUTE_PERCENT_AGAINST_INNER_SIZE; - case 8: return FLEX_BASIS_FIT_CONTENT_IN_MAIN_AXIS; case 2147483647: return ALL; case 2147483646: return CLASSIC; default: throw new IllegalArgumentException("Unknown enum value: " + value); diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp index 9166f1061791..995d70f6ebc7 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<0497864a0645d430ac6373047d6d2ea8>> */ /** @@ -399,12 +399,6 @@ class ReactNativeFeatureFlagsJavaProvider return method(javaProvider_); } - bool fixYogaFlexBasisFitContentInMainAxis() override { - static const auto method = - getReactNativeFeatureFlagsProviderJavaClass()->getMethod("fixYogaFlexBasisFitContentInMainAxis"); - return method(javaProvider_); - } - bool fuseboxAssertSingleHostState() override { static const auto method = getReactNativeFeatureFlagsProviderJavaClass()->getMethod("fuseboxAssertSingleHostState"); @@ -877,11 +871,6 @@ bool JReactNativeFeatureFlagsCxxInterop::fixTextClippingAndroid15useBoundsForWid return ReactNativeFeatureFlags::fixTextClippingAndroid15useBoundsForWidth(); } -bool JReactNativeFeatureFlagsCxxInterop::fixYogaFlexBasisFitContentInMainAxis( - facebook::jni::alias_ref /*unused*/) { - return ReactNativeFeatureFlags::fixYogaFlexBasisFitContentInMainAxis(); -} - bool JReactNativeFeatureFlagsCxxInterop::fuseboxAssertSingleHostState( facebook::jni::alias_ref /*unused*/) { return ReactNativeFeatureFlags::fuseboxAssertSingleHostState(); @@ -1233,9 +1222,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() { makeNativeMethod( "fixTextClippingAndroid15useBoundsForWidth", JReactNativeFeatureFlagsCxxInterop::fixTextClippingAndroid15useBoundsForWidth), - makeNativeMethod( - "fixYogaFlexBasisFitContentInMainAxis", - JReactNativeFeatureFlagsCxxInterop::fixYogaFlexBasisFitContentInMainAxis), makeNativeMethod( "fuseboxAssertSingleHostState", JReactNativeFeatureFlagsCxxInterop::fuseboxAssertSingleHostState), diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h index fec5cba60566..8d5b3d205463 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<9e245713f519765f04c5517c1de47c70>> */ /** @@ -210,9 +210,6 @@ class JReactNativeFeatureFlagsCxxInterop static bool fixTextClippingAndroid15useBoundsForWidth( facebook::jni::alias_ref); - static bool fixYogaFlexBasisFitContentInMainAxis( - facebook::jni::alias_ref); - static bool fuseboxAssertSingleHostState( facebook::jni::alias_ref); diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp index 19554bff3c9c..ff8bd07f24ff 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<6630f6e51cce8abe8457e6ca17b4db05>> + * @generated SignedSource<<10986d98341baa81d1aa3fc90f739367>> */ /** @@ -266,10 +266,6 @@ bool ReactNativeFeatureFlags::fixTextClippingAndroid15useBoundsForWidth() { return getAccessor().fixTextClippingAndroid15useBoundsForWidth(); } -bool ReactNativeFeatureFlags::fixYogaFlexBasisFitContentInMainAxis() { - return getAccessor().fixYogaFlexBasisFitContentInMainAxis(); -} - bool ReactNativeFeatureFlags::fuseboxAssertSingleHostState() { return getAccessor().fuseboxAssertSingleHostState(); } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h index d9959ce03338..566af020984f 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<988fab572d94253ccb4dc3e598fc154b>> + * @generated SignedSource<> */ /** @@ -339,11 +339,6 @@ class ReactNativeFeatureFlags { */ RN_EXPORT static bool fixTextClippingAndroid15useBoundsForWidth(); - /** - * When enabled, Yoga will not apply a FitContent constraint in the main axis during flex basis computation for non-measure container nodes. This prevents unnecessary re-measurement and cascading clones when a sibling changes size in a ScrollView. - */ - RN_EXPORT static bool fixYogaFlexBasisFitContentInMainAxis(); - /** * Enable system assertion validating that Fusebox is configured with a single host. When set, the CDP backend will dynamically disable features (Perf and Network) in the event that multiple hosts are registered (undefined behaviour), and broadcast this over `ReactNativeApplication.systemStateChanged`. */ diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp index ff8d694ed93e..577480cc07a4 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<52f88e97535e16551a393e2f6779652b>> + * @generated SignedSource<<2dfea8f52a640e8623f56371eec2ba0f>> */ /** @@ -1109,24 +1109,6 @@ bool ReactNativeFeatureFlagsAccessor::fixTextClippingAndroid15useBoundsForWidth( return flagValue.value(); } -bool ReactNativeFeatureFlagsAccessor::fixYogaFlexBasisFitContentInMainAxis() { - auto flagValue = fixYogaFlexBasisFitContentInMainAxis_.load(); - - if (!flagValue.has_value()) { - // This block is not exclusive but it is not necessary. - // If multiple threads try to initialize the feature flag, we would only - // be accessing the provider multiple times but the end state of this - // instance and the returned flag value would be the same. - - markFlagAsAccessed(60, "fixYogaFlexBasisFitContentInMainAxis"); - - flagValue = currentProvider_->fixYogaFlexBasisFitContentInMainAxis(); - fixYogaFlexBasisFitContentInMainAxis_ = flagValue; - } - - return flagValue.value(); -} - bool ReactNativeFeatureFlagsAccessor::fuseboxAssertSingleHostState() { auto flagValue = fuseboxAssertSingleHostState_.load(); @@ -1136,7 +1118,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxAssertSingleHostState() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(61, "fuseboxAssertSingleHostState"); + markFlagAsAccessed(60, "fuseboxAssertSingleHostState"); flagValue = currentProvider_->fuseboxAssertSingleHostState(); fuseboxAssertSingleHostState_ = flagValue; @@ -1154,7 +1136,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledRelease() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(62, "fuseboxEnabledRelease"); + markFlagAsAccessed(61, "fuseboxEnabledRelease"); flagValue = currentProvider_->fuseboxEnabledRelease(); fuseboxEnabledRelease_ = flagValue; @@ -1172,7 +1154,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxNetworkInspectionEnabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(63, "fuseboxNetworkInspectionEnabled"); + markFlagAsAccessed(62, "fuseboxNetworkInspectionEnabled"); flagValue = currentProvider_->fuseboxNetworkInspectionEnabled(); fuseboxNetworkInspectionEnabled_ = flagValue; @@ -1190,7 +1172,7 @@ bool ReactNativeFeatureFlagsAccessor::hideOffscreenVirtualViewsOnIOS() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(64, "hideOffscreenVirtualViewsOnIOS"); + markFlagAsAccessed(63, "hideOffscreenVirtualViewsOnIOS"); flagValue = currentProvider_->hideOffscreenVirtualViewsOnIOS(); hideOffscreenVirtualViewsOnIOS_ = flagValue; @@ -1208,7 +1190,7 @@ bool ReactNativeFeatureFlagsAccessor::overrideBySynchronousMountPropsAtMountingA // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(65, "overrideBySynchronousMountPropsAtMountingAndroid"); + markFlagAsAccessed(64, "overrideBySynchronousMountPropsAtMountingAndroid"); flagValue = currentProvider_->overrideBySynchronousMountPropsAtMountingAndroid(); overrideBySynchronousMountPropsAtMountingAndroid_ = flagValue; @@ -1226,7 +1208,7 @@ bool ReactNativeFeatureFlagsAccessor::perfIssuesEnabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(66, "perfIssuesEnabled"); + markFlagAsAccessed(65, "perfIssuesEnabled"); flagValue = currentProvider_->perfIssuesEnabled(); perfIssuesEnabled_ = flagValue; @@ -1244,7 +1226,7 @@ bool ReactNativeFeatureFlagsAccessor::perfMonitorV2Enabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(67, "perfMonitorV2Enabled"); + markFlagAsAccessed(66, "perfMonitorV2Enabled"); flagValue = currentProvider_->perfMonitorV2Enabled(); perfMonitorV2Enabled_ = flagValue; @@ -1262,7 +1244,7 @@ double ReactNativeFeatureFlagsAccessor::preparedTextCacheSize() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(68, "preparedTextCacheSize"); + markFlagAsAccessed(67, "preparedTextCacheSize"); flagValue = currentProvider_->preparedTextCacheSize(); preparedTextCacheSize_ = flagValue; @@ -1280,7 +1262,7 @@ bool ReactNativeFeatureFlagsAccessor::preventShadowTreeCommitExhaustion() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(69, "preventShadowTreeCommitExhaustion"); + markFlagAsAccessed(68, "preventShadowTreeCommitExhaustion"); flagValue = currentProvider_->preventShadowTreeCommitExhaustion(); preventShadowTreeCommitExhaustion_ = flagValue; @@ -1298,7 +1280,7 @@ bool ReactNativeFeatureFlagsAccessor::shouldPressibilityUseW3CPointerEventsForHo // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(70, "shouldPressibilityUseW3CPointerEventsForHover"); + markFlagAsAccessed(69, "shouldPressibilityUseW3CPointerEventsForHover"); flagValue = currentProvider_->shouldPressibilityUseW3CPointerEventsForHover(); shouldPressibilityUseW3CPointerEventsForHover_ = flagValue; @@ -1316,7 +1298,7 @@ bool ReactNativeFeatureFlagsAccessor::shouldTriggerResponderTransferOnScrollAndr // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(71, "shouldTriggerResponderTransferOnScrollAndroid"); + markFlagAsAccessed(70, "shouldTriggerResponderTransferOnScrollAndroid"); flagValue = currentProvider_->shouldTriggerResponderTransferOnScrollAndroid(); shouldTriggerResponderTransferOnScrollAndroid_ = flagValue; @@ -1334,7 +1316,7 @@ bool ReactNativeFeatureFlagsAccessor::skipActivityIdentityAssertionOnHostPause() // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(72, "skipActivityIdentityAssertionOnHostPause"); + markFlagAsAccessed(71, "skipActivityIdentityAssertionOnHostPause"); flagValue = currentProvider_->skipActivityIdentityAssertionOnHostPause(); skipActivityIdentityAssertionOnHostPause_ = flagValue; @@ -1352,7 +1334,7 @@ bool ReactNativeFeatureFlagsAccessor::syncAndroidClipToPaddingWithOverflow() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(73, "syncAndroidClipToPaddingWithOverflow"); + markFlagAsAccessed(72, "syncAndroidClipToPaddingWithOverflow"); flagValue = currentProvider_->syncAndroidClipToPaddingWithOverflow(); syncAndroidClipToPaddingWithOverflow_ = flagValue; @@ -1370,7 +1352,7 @@ bool ReactNativeFeatureFlagsAccessor::traceTurboModulePromiseRejectionsOnAndroid // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(74, "traceTurboModulePromiseRejectionsOnAndroid"); + markFlagAsAccessed(73, "traceTurboModulePromiseRejectionsOnAndroid"); flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid(); traceTurboModulePromiseRejectionsOnAndroid_ = flagValue; @@ -1388,7 +1370,7 @@ bool ReactNativeFeatureFlagsAccessor::updateRuntimeShadowNodeReferencesOnCommit( // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(75, "updateRuntimeShadowNodeReferencesOnCommit"); + markFlagAsAccessed(74, "updateRuntimeShadowNodeReferencesOnCommit"); flagValue = currentProvider_->updateRuntimeShadowNodeReferencesOnCommit(); updateRuntimeShadowNodeReferencesOnCommit_ = flagValue; @@ -1406,7 +1388,7 @@ bool ReactNativeFeatureFlagsAccessor::updateRuntimeShadowNodeReferencesOnCommitT // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(76, "updateRuntimeShadowNodeReferencesOnCommitThread"); + markFlagAsAccessed(75, "updateRuntimeShadowNodeReferencesOnCommitThread"); flagValue = currentProvider_->updateRuntimeShadowNodeReferencesOnCommitThread(); updateRuntimeShadowNodeReferencesOnCommitThread_ = flagValue; @@ -1424,7 +1406,7 @@ bool ReactNativeFeatureFlagsAccessor::useAlwaysAvailableJSErrorHandling() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(77, "useAlwaysAvailableJSErrorHandling"); + markFlagAsAccessed(76, "useAlwaysAvailableJSErrorHandling"); flagValue = currentProvider_->useAlwaysAvailableJSErrorHandling(); useAlwaysAvailableJSErrorHandling_ = flagValue; @@ -1442,7 +1424,7 @@ bool ReactNativeFeatureFlagsAccessor::useFabricInterop() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(78, "useFabricInterop"); + markFlagAsAccessed(77, "useFabricInterop"); flagValue = currentProvider_->useFabricInterop(); useFabricInterop_ = flagValue; @@ -1460,7 +1442,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeViewConfigsInBridgelessMode() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(79, "useNativeViewConfigsInBridgelessMode"); + markFlagAsAccessed(78, "useNativeViewConfigsInBridgelessMode"); flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode(); useNativeViewConfigsInBridgelessMode_ = flagValue; @@ -1478,7 +1460,7 @@ bool ReactNativeFeatureFlagsAccessor::useNestedScrollViewAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(80, "useNestedScrollViewAndroid"); + markFlagAsAccessed(79, "useNestedScrollViewAndroid"); flagValue = currentProvider_->useNestedScrollViewAndroid(); useNestedScrollViewAndroid_ = flagValue; @@ -1496,7 +1478,7 @@ bool ReactNativeFeatureFlagsAccessor::useSharedAnimatedBackend() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(81, "useSharedAnimatedBackend"); + markFlagAsAccessed(80, "useSharedAnimatedBackend"); flagValue = currentProvider_->useSharedAnimatedBackend(); useSharedAnimatedBackend_ = flagValue; @@ -1514,7 +1496,7 @@ bool ReactNativeFeatureFlagsAccessor::useTraitHiddenOnAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(82, "useTraitHiddenOnAndroid"); + markFlagAsAccessed(81, "useTraitHiddenOnAndroid"); flagValue = currentProvider_->useTraitHiddenOnAndroid(); useTraitHiddenOnAndroid_ = flagValue; @@ -1532,7 +1514,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModuleInterop() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(83, "useTurboModuleInterop"); + markFlagAsAccessed(82, "useTurboModuleInterop"); flagValue = currentProvider_->useTurboModuleInterop(); useTurboModuleInterop_ = flagValue; @@ -1550,7 +1532,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModules() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(84, "useTurboModules"); + markFlagAsAccessed(83, "useTurboModules"); flagValue = currentProvider_->useTurboModules(); useTurboModules_ = flagValue; @@ -1568,7 +1550,7 @@ bool ReactNativeFeatureFlagsAccessor::useUnorderedMapInDifferentiator() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(85, "useUnorderedMapInDifferentiator"); + markFlagAsAccessed(84, "useUnorderedMapInDifferentiator"); flagValue = currentProvider_->useUnorderedMapInDifferentiator(); useUnorderedMapInDifferentiator_ = flagValue; @@ -1586,7 +1568,7 @@ double ReactNativeFeatureFlagsAccessor::viewCullingOutsetRatio() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(86, "viewCullingOutsetRatio"); + markFlagAsAccessed(85, "viewCullingOutsetRatio"); flagValue = currentProvider_->viewCullingOutsetRatio(); viewCullingOutsetRatio_ = flagValue; @@ -1604,7 +1586,7 @@ bool ReactNativeFeatureFlagsAccessor::viewTransitionEnabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(87, "viewTransitionEnabled"); + markFlagAsAccessed(86, "viewTransitionEnabled"); flagValue = currentProvider_->viewTransitionEnabled(); viewTransitionEnabled_ = flagValue; @@ -1622,7 +1604,7 @@ double ReactNativeFeatureFlagsAccessor::virtualViewPrerenderRatio() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(88, "virtualViewPrerenderRatio"); + markFlagAsAccessed(87, "virtualViewPrerenderRatio"); flagValue = currentProvider_->virtualViewPrerenderRatio(); virtualViewPrerenderRatio_ = flagValue; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h index 57453119c374..572952e4a700 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> */ /** @@ -92,7 +92,6 @@ class ReactNativeFeatureFlagsAccessor { bool fixFindShadowNodeByTagRaceCondition(); bool fixMappingOfEventPrioritiesBetweenFabricAndReact(); bool fixTextClippingAndroid15useBoundsForWidth(); - bool fixYogaFlexBasisFitContentInMainAxis(); bool fuseboxAssertSingleHostState(); bool fuseboxEnabledRelease(); bool fuseboxNetworkInspectionEnabled(); @@ -132,7 +131,7 @@ class ReactNativeFeatureFlagsAccessor { std::unique_ptr currentProvider_; bool wasOverridden_; - std::array, 89> accessedFeatureFlags_; + std::array, 88> accessedFeatureFlags_; std::atomic> commonTestFlag_; std::atomic> cdpInteractionMetricsEnabled_; @@ -194,7 +193,6 @@ class ReactNativeFeatureFlagsAccessor { std::atomic> fixFindShadowNodeByTagRaceCondition_; std::atomic> fixMappingOfEventPrioritiesBetweenFabricAndReact_; std::atomic> fixTextClippingAndroid15useBoundsForWidth_; - std::atomic> fixYogaFlexBasisFitContentInMainAxis_; std::atomic> fuseboxAssertSingleHostState_; std::atomic> fuseboxEnabledRelease_; std::atomic> fuseboxNetworkInspectionEnabled_; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h index e68ac54d4010..b3e9072dc6ed 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> */ /** @@ -267,10 +267,6 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider { return false; } - bool fixYogaFlexBasisFitContentInMainAxis() override { - return false; - } - bool fuseboxAssertSingleHostState() override { return true; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h index 914a9750f2de..4bb534211097 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<5b75038b551675ce0272327b3d3a8040>> + * @generated SignedSource<> */ /** @@ -585,15 +585,6 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef return ReactNativeFeatureFlagsDefaults::fixTextClippingAndroid15useBoundsForWidth(); } - bool fixYogaFlexBasisFitContentInMainAxis() override { - auto value = values_["fixYogaFlexBasisFitContentInMainAxis"]; - if (!value.isNull()) { - return value.getBool(); - } - - return ReactNativeFeatureFlagsDefaults::fixYogaFlexBasisFitContentInMainAxis(); - } - bool fuseboxAssertSingleHostState() override { auto value = values_["fuseboxAssertSingleHostState"]; if (!value.isNull()) { diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h index 1185afcb774a..0d4c0e469c06 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<4fe7e087f4f531772fe08943888c24d8>> */ /** @@ -85,7 +85,6 @@ class ReactNativeFeatureFlagsProvider { virtual bool fixFindShadowNodeByTagRaceCondition() = 0; virtual bool fixMappingOfEventPrioritiesBetweenFabricAndReact() = 0; virtual bool fixTextClippingAndroid15useBoundsForWidth() = 0; - virtual bool fixYogaFlexBasisFitContentInMainAxis() = 0; virtual bool fuseboxAssertSingleHostState() = 0; virtual bool fuseboxEnabledRelease() = 0; virtual bool fuseboxNetworkInspectionEnabled() = 0; diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp index 3da272f54e6b..dfb54ad546d8 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<600173d3cb27205c13d0ab7fe7ab8edb>> + * @generated SignedSource<> */ /** @@ -344,11 +344,6 @@ bool NativeReactNativeFeatureFlags::fixTextClippingAndroid15useBoundsForWidth( return ReactNativeFeatureFlags::fixTextClippingAndroid15useBoundsForWidth(); } -bool NativeReactNativeFeatureFlags::fixYogaFlexBasisFitContentInMainAxis( - jsi::Runtime& /*runtime*/) { - return ReactNativeFeatureFlags::fixYogaFlexBasisFitContentInMainAxis(); -} - bool NativeReactNativeFeatureFlags::fuseboxAssertSingleHostState( jsi::Runtime& /*runtime*/) { return ReactNativeFeatureFlags::fuseboxAssertSingleHostState(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h index cacc016dddee..7d32b6791df7 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<4a51c6eacd3990f204dc88a9e0cac764>> */ /** @@ -156,8 +156,6 @@ class NativeReactNativeFeatureFlags bool fixTextClippingAndroid15useBoundsForWidth(jsi::Runtime& runtime); - bool fixYogaFlexBasisFitContentInMainAxis(jsi::Runtime& runtime); - bool fuseboxAssertSingleHostState(jsi::Runtime& runtime); bool fuseboxEnabledRelease(jsi::Runtime& runtime); 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 bd7fbed5b5ec..bd327efc3512 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp @@ -599,13 +599,10 @@ void YogaLayoutableShadowNode::layoutTree( { TraceSection s2("YogaLayoutableShadowNode::configureYogaTree"); - YGErrata defaultErrata = YGErrataAll; - if (ReactNativeFeatureFlags::fixYogaFlexBasisFitContentInMainAxis()) { - defaultErrata = static_cast( - defaultErrata & ~YGErrataFlexBasisFitContentInMainAxis); - } configureYogaTree( - layoutContext.pointScaleFactor, defaultErrata, swapLeftAndRight); + layoutContext.pointScaleFactor, + YGErrataAll /*defaultErrata*/, + swapLeftAndRight); } auto minimumSize = layoutConstraints.minimumSize; diff --git a/packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp b/packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp index 233a1e78bcce..9fc4a83a82da 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp +++ b/packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp @@ -117,8 +117,6 @@ const char* YGErrataToString(const YGErrata value) { return "absolute-position-without-insets-excludes-padding"; case YGErrataAbsolutePercentAgainstInnerSize: return "absolute-percent-against-inner-size"; - case YGErrataFlexBasisFitContentInMainAxis: - return "flex-basis-fit-content-in-main-axis"; case YGErrataAll: return "all"; case YGErrataClassic: diff --git a/packages/react-native/ReactCommon/yoga/yoga/YGEnums.h b/packages/react-native/ReactCommon/yoga/yoga/YGEnums.h index b9f66a062780..1b69f0931861 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/YGEnums.h +++ b/packages/react-native/ReactCommon/yoga/yoga/YGEnums.h @@ -67,7 +67,6 @@ YG_ENUM_DECL( YGErrataStretchFlexBasis = 1, YGErrataAbsolutePositionWithoutInsetsExcludesPadding = 2, YGErrataAbsolutePercentAgainstInnerSize = 4, - YGErrataFlexBasisFitContentInMainAxis = 8, YGErrataAll = 2147483647, YGErrataClassic = 2147483646) YG_DEFINE_ENUM_FLAG_OPERATORS(YGErrata) diff --git a/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp b/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp index a9bcaf78d0e9..0a7224cc0b57 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp +++ b/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp @@ -94,10 +94,7 @@ static void computeFlexBasisForChild( const bool isColumnStyleDimDefined = child->hasDefiniteLength(Dimension::Height, ownerHeight); - if (resolvedFlexBasis.isDefined() && - (yoga::isDefined(mainAxisSize) || - (!node->hasErrata(Errata::FlexBasisFitContentInMainAxis) && - resolvedFlexBasis.unwrap() > 0))) { + if (resolvedFlexBasis.isDefined() && yoga::isDefined(mainAxisSize)) { if (child->getLayout().computedFlexBasis.isUndefined() || (child->getConfig()->isExperimentalFeatureEnabled( ExperimentalFeature::WebFlexBasis) && @@ -159,57 +156,19 @@ static void computeFlexBasisForChild( // The W3C spec doesn't say anything about the 'overflow' property, but all // major browsers appear to implement the following logic. - // - // In the cross axis, children should always be bounded by the parent's - // available space (FitContent). In the main axis, the flex basis should - // be the child's intrinsic size under max-content constraint. - // - // The legacy behavior (FlexBasisFitContentInMainAxis errata) applies a - // FitContent constraint in the main axis for non-scroll containers, which - // causes unnecessary re-measurement and cascading clones when the parent's - // content-determined size changes (e.g. when a sibling's height changes - // in a ScrollView). - // - // The corrected behavior leaves the main axis unconstrained for container - // children (no measure function), and preserves the FitContent constraint - // for measure function nodes (e.g. text) to support text wrapping. - if (node->hasErrata(Errata::FlexBasisFitContentInMainAxis)) { - // Legacy behavior: apply FitContent in both axes (except main axis for - // scroll containers). - if ((!isMainAxisRow && node->style().overflow() == Overflow::Scroll) || - node->style().overflow() != Overflow::Scroll) { - if (yoga::isUndefined(childWidth) && yoga::isDefined(width)) { - childWidth = width; - childWidthSizingMode = SizingMode::FitContent; - } - } - - if ((isMainAxisRow && node->style().overflow() == Overflow::Scroll) || - node->style().overflow() != Overflow::Scroll) { - if (yoga::isUndefined(childHeight) && yoga::isDefined(height)) { - childHeight = height; - childHeightSizingMode = SizingMode::FitContent; - } - } - } else { - // Corrected behavior: only apply FitContent in the cross axis, or in - // the main axis for measure function nodes in non-scroll containers. - if (!isMainAxisRow || - (child->hasMeasureFunc() && - node->style().overflow() != Overflow::Scroll)) { - if (yoga::isUndefined(childWidth) && yoga::isDefined(width)) { - childWidth = width; - childWidthSizingMode = SizingMode::FitContent; - } + if ((!isMainAxisRow && node->style().overflow() == Overflow::Scroll) || + node->style().overflow() != Overflow::Scroll) { + if (yoga::isUndefined(childWidth) && yoga::isDefined(width)) { + childWidth = width; + childWidthSizingMode = SizingMode::FitContent; } + } - if (isMainAxisRow || - (child->hasMeasureFunc() && - node->style().overflow() != Overflow::Scroll)) { - if (yoga::isUndefined(childHeight) && yoga::isDefined(height)) { - childHeight = height; - childHeightSizingMode = SizingMode::FitContent; - } + if ((isMainAxisRow && node->style().overflow() == Overflow::Scroll) || + node->style().overflow() != Overflow::Scroll) { + if (yoga::isUndefined(childHeight) && yoga::isDefined(height)) { + childHeight = height; + childHeightSizingMode = SizingMode::FitContent; } } @@ -578,8 +537,6 @@ static float computeFlexBasisForChildren( yoga::Node* const node, const float availableInnerWidth, const float availableInnerHeight, - const float ownerWidth, - const float ownerHeight, SizingMode widthSizingMode, SizingMode heightSizingMode, Direction direction, @@ -641,8 +598,8 @@ static float computeFlexBasisForChildren( availableInnerWidth, widthSizingMode, availableInnerHeight, - ownerWidth, - ownerHeight, + availableInnerWidth, + availableInnerHeight, heightSizingMode, direction, layoutMarkerData, @@ -1472,56 +1429,12 @@ static void calculateLayoutImpl( // STEP 3: DETERMINE FLEX BASIS FOR EACH ITEM - // When this node is measured with MaxContent (corrected - // FlexBasisFitContentInMainAxis behavior), availableInnerHeight/Width is NaN. - // To preserve percentage resolution for descendants, derive a definite - // owner-size from the parent-provided ownerHeight/ownerWidth. - float ownerWidthForChildren = availableInnerWidth; - float ownerHeightForChildren = availableInnerHeight; - - if (!node->hasErrata(Errata::FlexBasisFitContentInMainAxis)) { - // Do not propagate the fallback when this node is a direct child of a - // scroll container. In scroll contexts, the scroll axis is intentionally - // indefinite and percentage-based children should not resolve against the - // viewport size. - const auto* owner = node->getOwner(); - const bool isChildOfScrollContainer = - owner != nullptr && owner->style().overflow() == Overflow::Scroll; - - if (!isChildOfScrollContainer) { - if (yoga::isUndefined(ownerWidthForChildren) && - yoga::isDefined(ownerWidth)) { - ownerWidthForChildren = calculateAvailableInnerDimension( - node, - direction, - Dimension::Width, - ownerWidth - marginAxisRow, - paddingAndBorderAxisRow, - ownerWidth, - ownerWidth); - } - if (yoga::isUndefined(ownerHeightForChildren) && - yoga::isDefined(ownerHeight)) { - ownerHeightForChildren = calculateAvailableInnerDimension( - node, - direction, - Dimension::Height, - ownerHeight - marginAxisColumn, - paddingAndBorderAxisColumn, - ownerHeight, - ownerWidth); - } - } - } - // Computed basis + margins + gap float totalMainDim = 0; totalMainDim += computeFlexBasisForChildren( node, availableInnerWidth, availableInnerHeight, - ownerWidthForChildren, - ownerHeightForChildren, widthSizingMode, heightSizingMode, direction, diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/Errata.h b/packages/react-native/ReactCommon/yoga/yoga/enums/Errata.h index 86d8409b15b3..2f47a941751f 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/Errata.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/Errata.h @@ -20,7 +20,6 @@ enum class Errata : uint32_t { StretchFlexBasis = YGErrataStretchFlexBasis, AbsolutePositionWithoutInsetsExcludesPadding = YGErrataAbsolutePositionWithoutInsetsExcludesPadding, AbsolutePercentAgainstInnerSize = YGErrataAbsolutePercentAgainstInnerSize, - FlexBasisFitContentInMainAxis = YGErrataFlexBasisFitContentInMainAxis, All = YGErrataAll, Classic = YGErrataClassic, }; diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index 2f2ef70dc421..f5cf49d0646b 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -689,17 +689,6 @@ const definitions: FeatureFlagDefinitions = { }, ossReleaseStage: 'experimental', }, - fixYogaFlexBasisFitContentInMainAxis: { - defaultValue: false, - metadata: { - dateAdded: '2026-02-26', - description: - 'When enabled, Yoga will not apply a FitContent constraint in the main axis during flex basis computation for non-measure container nodes. This prevents unnecessary re-measurement and cascading clones when a sibling changes size in a ScrollView.', - expectedReleaseValue: true, - purpose: 'experimentation', - }, - ossReleaseStage: 'none', - }, fuseboxAssertSingleHostState: { defaultValue: true, metadata: { diff --git a/packages/react-native/src/private/__tests__/utilities/__tests__/ShadowNodeRevisionGetter-itest.js b/packages/react-native/src/private/__tests__/utilities/__tests__/ShadowNodeRevisionGetter-itest.js index 19cfe722bc8b..f5bd1e3bfbd5 100644 --- a/packages/react-native/src/private/__tests__/utilities/__tests__/ShadowNodeRevisionGetter-itest.js +++ b/packages/react-native/src/private/__tests__/utilities/__tests__/ShadowNodeRevisionGetter-itest.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @fantom_flags enableFabricCommitBranching:* fixYogaFlexBasisFitContentInMainAxis:* + * @fantom_flags enableFabricCommitBranching:* * @flow strict-local * @format */ @@ -15,7 +15,6 @@ import {createShadowNodeReferenceGetterRef} from '../ShadowNodeRevisionGetter'; import * as Fantom from '@react-native/fantom'; import * as React from 'react'; import {ScrollView, View} from 'react-native'; -import {fixYogaFlexBasisFitContentInMainAxis} from 'react-native/src/private/featureflags/ReactNativeFeatureFlags'; test('base case when cloning results in revision +1', () => { const root = Fantom.createRoot(); @@ -71,10 +70,6 @@ test('changing height of the top item in ScrollView results in excessive cloning ); }); - if (fixYogaFlexBasisFitContentInMainAxis()) { - expect(getRevision()).toBe(1); - } else { - // TODO(T225268793): the below assertion should be: `expect(getRevision()).toBe(1);` - expect(getRevision()).toBe(2); - } + // TODO(T225268793): the below assertion should be: `expect(getRevision()).toBe(1);` + expect(getRevision()).toBe(2); }); diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index a772f19bee88..4fe81841c8db 100644 --- a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<75d6c8b2ed8a5cf5f3de44d1d6392c58>> + * @generated SignedSource<> * @flow strict * @noformat */ @@ -108,7 +108,6 @@ export type ReactNativeFeatureFlags = $ReadOnly<{ fixFindShadowNodeByTagRaceCondition: Getter, fixMappingOfEventPrioritiesBetweenFabricAndReact: Getter, fixTextClippingAndroid15useBoundsForWidth: Getter, - fixYogaFlexBasisFitContentInMainAxis: Getter, fuseboxAssertSingleHostState: Getter, fuseboxEnabledRelease: Getter, fuseboxNetworkInspectionEnabled: Getter, @@ -448,10 +447,6 @@ export const fixMappingOfEventPrioritiesBetweenFabricAndReact: Getter = * Fix text clipping starting in Android 15 due to usage of useBoundsForWidth */ export const fixTextClippingAndroid15useBoundsForWidth: Getter = createNativeFlagGetter('fixTextClippingAndroid15useBoundsForWidth', false); -/** - * When enabled, Yoga will not apply a FitContent constraint in the main axis during flex basis computation for non-measure container nodes. This prevents unnecessary re-measurement and cascading clones when a sibling changes size in a ScrollView. - */ -export const fixYogaFlexBasisFitContentInMainAxis: Getter = createNativeFlagGetter('fixYogaFlexBasisFitContentInMainAxis', false); /** * Enable system assertion validating that Fusebox is configured with a single host. When set, the CDP backend will dynamically disable features (Perf and Network) in the event that multiple hosts are registered (undefined behaviour), and broadcast this over `ReactNativeApplication.systemStateChanged`. */ diff --git a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js index 74cd4123ba03..cfcee4a23c05 100644 --- a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<4cc26e6b776088c9e80b5857e82cd9df>> + * @generated SignedSource<<174d4b001feed817ad74b441b6dae50d>> * @flow strict * @noformat */ @@ -85,7 +85,6 @@ export interface Spec extends TurboModule { +fixFindShadowNodeByTagRaceCondition?: () => boolean; +fixMappingOfEventPrioritiesBetweenFabricAndReact?: () => boolean; +fixTextClippingAndroid15useBoundsForWidth?: () => boolean; - +fixYogaFlexBasisFitContentInMainAxis?: () => boolean; +fuseboxAssertSingleHostState?: () => boolean; +fuseboxEnabledRelease?: () => boolean; +fuseboxNetworkInspectionEnabled?: () => boolean;