From 649ddbe7aa957b78339b11ccf3918d2c648d0cc3 Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Thu, 18 Jan 2024 05:37:42 -0800 Subject: [PATCH] remove gating for rtl swapping fix + clean Paragraph Yoga node (#42297) Summary: changelog: [internal] Reviewed By: fkgozali Differential Revision: D52728092 --- .../com/facebook/react/config/ReactFeatureFlags.java | 6 ------ .../src/main/jni/react/fabric/Binding.cpp | 4 ---- .../renderer/components/text/ParagraphShadowNode.cpp | 12 +++++------- .../components/view/YogaLayoutableShadowNode.cpp | 6 ++---- .../ReactCommon/react/utils/CoreFeatures.cpp | 2 -- .../ReactCommon/react/utils/CoreFeatures.h | 6 ------ 6 files changed, 7 insertions(+), 29 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java index 3349b35d1246f5..250772c9015e91 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java @@ -130,12 +130,6 @@ public class ReactFeatureFlags { /** Use native view configs in bridgeless mode. */ public static boolean useNativeViewConfigsInBridgelessMode = false; - /** Only swap left and right on Android in RTL scripts. */ - public static boolean doNotSwapLeftAndRightOnAndroidInLTR = false; - - /** Clean yoga node when does not change. */ - public static boolean enableCleanParagraphYogaNode = false; - /** Default state updates and events to async batched priority. */ public static boolean enableDefaultAsyncBatchedPriority = false; diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/Binding.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/Binding.cpp index 0f89b1ee8fe29b..3331911f0f17ec 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/Binding.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/Binding.cpp @@ -414,10 +414,6 @@ void Binding::installFabricUIManager( CoreFeatures::enablePropIteratorSetter = getFeatureFlagValue("enableCppPropsIteratorSetter"); - CoreFeatures::doNotSwapLeftAndRightOnAndroidInLTR = - getFeatureFlagValue("doNotSwapLeftAndRightOnAndroidInLTR"); - CoreFeatures::enableCleanParagraphYogaNode = - getFeatureFlagValue("enableCleanParagraphYogaNode"); CoreFeatures::enableDefaultAsyncBatchedPriority = getFeatureFlagValue("enableDefaultAsyncBatchedPriority"); CoreFeatures::enableClonelessStateProgression = diff --git a/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphShadowNode.cpp b/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphShadowNode.cpp index ca5761652b6171..6a17715dab35bf 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphShadowNode.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphShadowNode.cpp @@ -31,13 +31,11 @@ ParagraphShadowNode::ParagraphShadowNode( const ShadowNode& sourceShadowNode, const ShadowNodeFragment& fragment) : ConcreteViewShadowNode(sourceShadowNode, fragment) { - if (CoreFeatures::enableCleanParagraphYogaNode) { - if (!fragment.children && !fragment.props) { - // This ParagraphShadowNode was cloned but did not change - // in a way that affects its layout. Let's mark it clean - // to stop Yoga from traversing it. - cleanLayout(); - } + if (!fragment.children && !fragment.props) { + // This ParagraphShadowNode was cloned but did not change + // in a way that affects its layout. Let's mark it clean + // to stop Yoga from traversing it. + cleanLayout(); } } 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 08a3220e56396d..accb37664809a9 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp @@ -580,8 +580,7 @@ void YogaLayoutableShadowNode::layoutTree( SystraceSection s1("YogaLayoutableShadowNode::layoutTree"); bool swapLeftAndRight = layoutContext.swapLeftAndRightInRTL && - (layoutConstraints.layoutDirection == LayoutDirection::RightToLeft || - !CoreFeatures::doNotSwapLeftAndRightOnAndroidInLTR); + layoutConstraints.layoutDirection == LayoutDirection::RightToLeft; { SystraceSection s2("YogaLayoutableShadowNode::configureYogaTree"); @@ -699,8 +698,7 @@ void YogaLayoutableShadowNode::layout(LayoutContext layoutContext) { newLayoutMetrics.pointScaleFactor = layoutContext.pointScaleFactor; newLayoutMetrics.wasLeftAndRightSwapped = layoutContext.swapLeftAndRightInRTL && - (newLayoutMetrics.layoutDirection == LayoutDirection::RightToLeft || - !CoreFeatures::doNotSwapLeftAndRightOnAndroidInLTR); + newLayoutMetrics.layoutDirection == LayoutDirection::RightToLeft; // Child node's layout has changed. When a node is added to // `affectedNodes`, onLayout event is called on the component. Comparing diff --git a/packages/react-native/ReactCommon/react/utils/CoreFeatures.cpp b/packages/react-native/ReactCommon/react/utils/CoreFeatures.cpp index c967febaac7a21..fcdc92e97f9941 100644 --- a/packages/react-native/ReactCommon/react/utils/CoreFeatures.cpp +++ b/packages/react-native/ReactCommon/react/utils/CoreFeatures.cpp @@ -15,8 +15,6 @@ bool CoreFeatures::cacheLastTextMeasurement = false; bool CoreFeatures::cancelImageDownloadsOnRecycle = false; bool CoreFeatures::enableGranularScrollViewStateUpdatesIOS = false; bool CoreFeatures::enableMountHooks = false; -bool CoreFeatures::doNotSwapLeftAndRightOnAndroidInLTR = false; -bool CoreFeatures::enableCleanParagraphYogaNode = false; bool CoreFeatures::enableGranularShadowTreeStateReconciliation = false; bool CoreFeatures::enableDefaultAsyncBatchedPriority = false; bool CoreFeatures::enableClonelessStateProgression = false; diff --git a/packages/react-native/ReactCommon/react/utils/CoreFeatures.h b/packages/react-native/ReactCommon/react/utils/CoreFeatures.h index 3ad24c5e02e4d8..2af28d74a10b9e 100644 --- a/packages/react-native/ReactCommon/react/utils/CoreFeatures.h +++ b/packages/react-native/ReactCommon/react/utils/CoreFeatures.h @@ -41,12 +41,6 @@ class CoreFeatures { // Report mount operations from the host platform to notify mount hooks. static bool enableMountHooks; - // Only swap left and right on Android in RTL scripts. - static bool doNotSwapLeftAndRightOnAndroidInLTR; - - // Clean yoga node when does not change. - static bool enableCleanParagraphYogaNode; - // When enabled, the renderer would only fail commits when they propagate // state and the last commit that updated state changed before committing. static bool enableGranularShadowTreeStateReconciliation;