diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index 07b31c52d88..40395051745 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -7028,11 +7028,10 @@ public abstract interface class com/facebook/react/views/scroll/ReactScrollViewH } public final class com/facebook/react/views/scroll/ReactScrollViewHelper$ReactScrollViewScrollState { - public fun (I)V + public fun ()V public final fun getDecelerationRate ()F public final fun getFinalAnimatedPositionScroll ()Landroid/graphics/Point; public final fun getLastStateUpdateScroll ()Landroid/graphics/Point; - public final fun getLayoutDirection ()I public final fun getScrollAwayPaddingTop ()I public final fun isCanceled ()Z public final fun isFinished ()Z diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java index 2bfb30be904..62643f3ea84 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java @@ -800,12 +800,10 @@ public class SurfaceMountingManager { throw new IllegalStateException("Unable to find View for tag: " + reactTag); } - if (ReactNativeFeatureFlags.setAndroidLayoutDirection()) { - viewToUpdate.setLayoutDirection( - layoutDirection == 1 - ? View.LAYOUT_DIRECTION_LTR - : layoutDirection == 2 ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_INHERIT); - } + viewToUpdate.setLayoutDirection( + layoutDirection == 1 + ? View.LAYOUT_DIRECTION_LTR + : layoutDirection == 2 ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_INHERIT); // Even though we have exact dimensions, we still call measure because some platform views (e.g. // Switch) assume that method will always be called before onLayout and onDraw. They use it to diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.java index 19dd9ce0f1b..0dcf5402319 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.java @@ -153,15 +153,9 @@ final class IntBufferBatchMountItem implements BatchMountItem { int width = mIntBuffer[i++]; int height = mIntBuffer[i++]; int displayType = mIntBuffer[i++]; - - if (ReactNativeFeatureFlags.setAndroidLayoutDirection()) { - int layoutDirection = mIntBuffer[i++]; - surfaceMountingManager.updateLayout( - reactTag, parentTag, x, y, width, height, displayType, layoutDirection); - } else { - surfaceMountingManager.updateLayout( - reactTag, parentTag, x, y, width, height, displayType, 0); - } + int layoutDirection = mIntBuffer[i++]; + surfaceMountingManager.updateLayout( + reactTag, parentTag, x, y, width, height, displayType, layoutDirection); } else if (type == INSTRUCTION_UPDATE_PADDING) { surfaceMountingManager.updatePadding( mIntBuffer[i++], mIntBuffer[i++], mIntBuffer[i++], mIntBuffer[i++], mIntBuffer[i++]); @@ -251,8 +245,7 @@ final class IntBufferBatchMountItem implements BatchMountItem { int w = mIntBuffer[i++]; int h = mIntBuffer[i++]; int displayType = mIntBuffer[i++]; - int layoutDirection = - ReactNativeFeatureFlags.setAndroidLayoutDirection() ? mIntBuffer[i++] : 0; + int layoutDirection = mIntBuffer[i++]; s.append( String.format( "UPDATE LAYOUT [%d]->[%d]: x:%d y:%d w:%d h:%d displayType:%d layoutDirection:" 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 40e9ca3f95e..43a8f237baf 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<<124e8e4892062fa63a9a70ae0c53653d>> + * @generated SignedSource<> */ /** @@ -238,12 +238,6 @@ public object ReactNativeFeatureFlags { @JvmStatic public fun loadVectorDrawablesOnImages(): Boolean = accessor.loadVectorDrawablesOnImages() - /** - * Propagate layout direction to Android views. - */ - @JvmStatic - public fun setAndroidLayoutDirection(): Boolean = accessor.setAndroidLayoutDirection() - /** * Enables storing js caller stack when creating promise in native module. This is useful in case of Promise rejection and tracing the cause. */ 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 1c93f7cf906..e9348546425 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<<28da40176c64703dcab4bc0d1af078a8>> + * @generated SignedSource<<7dd21b62dfe429aecdbd179cb482fb26>> */ /** @@ -55,7 +55,6 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso private var initEagerTurboModulesOnNativeModulesQueueAndroidCache: Boolean? = null private var lazyAnimationCallbacksCache: Boolean? = null private var loadVectorDrawablesOnImagesCache: Boolean? = null - private var setAndroidLayoutDirectionCache: Boolean? = null private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null private var useAlwaysAvailableJSErrorHandlingCache: Boolean? = null private var useFabricInteropCache: Boolean? = null @@ -382,15 +381,6 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso return cached } - override fun setAndroidLayoutDirection(): Boolean { - var cached = setAndroidLayoutDirectionCache - if (cached == null) { - cached = ReactNativeFeatureFlagsCxxInterop.setAndroidLayoutDirection() - setAndroidLayoutDirectionCache = cached - } - return cached - } - override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean { var cached = traceTurboModulePromiseRejectionsOnAndroidCache 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 a3bf6bf6952..fdb06efef7f 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<> */ /** @@ -98,8 +98,6 @@ public object ReactNativeFeatureFlagsCxxInterop { @DoNotStrip @JvmStatic public external fun loadVectorDrawablesOnImages(): Boolean - @DoNotStrip @JvmStatic public external fun setAndroidLayoutDirection(): Boolean - @DoNotStrip @JvmStatic public external fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean @DoNotStrip @JvmStatic public external fun useAlwaysAvailableJSErrorHandling(): 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 d6f2ed89dde..4d05f17c1c8 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<<3d25d7b8ee194721c39fb5eb5eda87d4>> + * @generated SignedSource<<86d8dd894e80a788af7f47172d30d33c>> */ /** @@ -93,8 +93,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi override fun loadVectorDrawablesOnImages(): Boolean = false - override fun setAndroidLayoutDirection(): Boolean = true - override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean = false override fun useAlwaysAvailableJSErrorHandling(): 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 403fe12da87..15fc6fa6b70 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<<4bb5173b9ba1d3e620f3a7d613b27ac7>> */ /** @@ -59,7 +59,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces private var initEagerTurboModulesOnNativeModulesQueueAndroidCache: Boolean? = null private var lazyAnimationCallbacksCache: Boolean? = null private var loadVectorDrawablesOnImagesCache: Boolean? = null - private var setAndroidLayoutDirectionCache: Boolean? = null private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null private var useAlwaysAvailableJSErrorHandlingCache: Boolean? = null private var useFabricInteropCache: Boolean? = null @@ -421,16 +420,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces return cached } - override fun setAndroidLayoutDirection(): Boolean { - var cached = setAndroidLayoutDirectionCache - if (cached == null) { - cached = currentProvider.setAndroidLayoutDirection() - accessedFeatureFlags.add("setAndroidLayoutDirection") - setAndroidLayoutDirectionCache = cached - } - return cached - } - override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean { var cached = traceTurboModulePromiseRejectionsOnAndroidCache 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 f068bbc4d09..1915e599a69 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<<24bae6a173c941923c84f418a114ec2f>> + * @generated SignedSource<<2217f2b9992c9424c3d1d221bdfa2236>> */ /** @@ -93,8 +93,6 @@ public interface ReactNativeFeatureFlagsProvider { @DoNotStrip public fun loadVectorDrawablesOnImages(): Boolean - @DoNotStrip public fun setAndroidLayoutDirection(): Boolean - @DoNotStrip public fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean @DoNotStrip public fun useAlwaysAvailableJSErrorHandling(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java index b5b1151317e..9f37e762035 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java @@ -27,7 +27,6 @@ import com.facebook.react.bridge.RetryableMountingLayerException; import com.facebook.react.bridge.SoftAssertions; import com.facebook.react.bridge.UiThreadUtil; import com.facebook.react.common.build.ReactBuildConfig; -import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags; import com.facebook.react.touch.JSResponderHandler; import com.facebook.react.uimanager.layoutanimation.LayoutAnimationController; import com.facebook.react.uimanager.layoutanimation.LayoutAnimationListener; @@ -178,9 +177,7 @@ public class NativeViewHierarchyManager { try { View viewToUpdate = resolveView(tag); - if (ReactNativeFeatureFlags.setAndroidLayoutDirection()) { - viewToUpdate.setLayoutDirection(LayoutDirectionUtil.toAndroidFromYoga(layoutDirection)); - } + viewToUpdate.setLayoutDirection(LayoutDirectionUtil.toAndroidFromYoga(layoutDirection)); // Even though we have exact dimensions, we still call measure because some platform views // (e.g. diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java index afce0efce2e..8dc00b6bd1f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java @@ -37,8 +37,6 @@ import com.facebook.react.animated.NativeAnimatedModule; import com.facebook.react.bridge.ReactContext; import com.facebook.react.common.ReactConstants; import com.facebook.react.common.build.ReactBuildConfig; -import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags; -import com.facebook.react.modules.i18nmanager.I18nUtil; import com.facebook.react.uimanager.BackgroundStyleApplicator; import com.facebook.react.uimanager.LengthPercentage; import com.facebook.react.uimanager.LengthPercentageType; @@ -139,13 +137,7 @@ public class ReactHorizontalScrollView extends HorizontalScrollView ViewCompat.setAccessibilityDelegate(this, new ReactScrollViewAccessibilityDelegate()); mScroller = getOverScrollerFromParent(); - mReactScrollViewScrollState = - new ReactScrollViewScrollState( - // TODO: The ScrollView content may be laid out in a different direction than the - // instance if the `direction` style is set on the ScrollView or above it. - I18nUtil.getInstance().isRTL(context) - ? ViewCompat.LAYOUT_DIRECTION_RTL - : ViewCompat.LAYOUT_DIRECTION_LTR); + mReactScrollViewScrollState = new ReactScrollViewScrollState(); setOnHierarchyChangeListener(this); setClipChildren(false); @@ -1088,13 +1080,9 @@ public class ReactHorizontalScrollView extends HorizontalScrollView int firstOffset = 0; int lastOffset = maximumOffset; int width = getWidth() - ViewCompat.getPaddingStart(this) - ViewCompat.getPaddingEnd(this); - int layoutDirection = - ReactNativeFeatureFlags.setAndroidLayoutDirection() - ? getLayoutDirection() - : mReactScrollViewScrollState.getLayoutDirection(); // offsets are from the right edge in RTL layouts - if (layoutDirection == LAYOUT_DIRECTION_RTL) { + if (getLayoutDirection() == LAYOUT_DIRECTION_RTL) { targetOffset = maximumOffset - targetOffset; velocityX = -velocityX; } @@ -1184,7 +1172,7 @@ public class ReactHorizontalScrollView extends HorizontalScrollView // if scrolling after the last snap offset and snapping to the // end of the list is disabled, then we allow free scrolling int currentOffset = getScrollX(); - if (layoutDirection == LAYOUT_DIRECTION_RTL) { + if (getLayoutDirection() == LAYOUT_DIRECTION_RTL) { currentOffset = maximumOffset - currentOffset; } if (!mSnapToEnd && targetOffset >= lastOffset) { @@ -1224,7 +1212,7 @@ public class ReactHorizontalScrollView extends HorizontalScrollView // Make sure the new offset isn't out of bounds targetOffset = Math.min(Math.max(0, targetOffset), maximumOffset); - if (layoutDirection == LAYOUT_DIRECTION_RTL) { + if (getLayoutDirection() == LAYOUT_DIRECTION_RTL) { targetOffset = maximumOffset - targetOffset; velocityX = -velocityX; } @@ -1423,11 +1411,7 @@ public class ReactHorizontalScrollView extends HorizontalScrollView // does not shift layout. If `maintainVisibleContentPosition` is enabled, we try to adjust // position so that the viewport keeps the same insets to previously visible views. TODO: MVCP // does not work in RTL. - int layoutDirection = - ReactNativeFeatureFlags.setAndroidLayoutDirection() - ? v.getLayoutDirection() - : mReactScrollViewScrollState.getLayoutDirection(); - if (layoutDirection == LAYOUT_DIRECTION_RTL) { + if (v.getLayoutDirection() == LAYOUT_DIRECTION_RTL) { adjustPositionForContentChangeRTL(left, right, oldLeft, oldRight); } else if (mMaintainVisibleContentPositionHelper != null) { mMaintainVisibleContentPositionHelper.updateScrollPosition(); diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java index 4b4885deb1e..adf92c118ea 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java @@ -119,7 +119,7 @@ public class ReactScrollView extends ScrollView private int pendingContentOffsetY = UNSET_CONTENT_OFFSET; private @Nullable StateWrapper mStateWrapper = null; private final ReactScrollViewScrollState mReactScrollViewScrollState = - new ReactScrollViewScrollState(ViewCompat.LAYOUT_DIRECTION_LTR); + new ReactScrollViewScrollState(); private final ValueAnimator DEFAULT_FLING_ANIMATOR = ObjectAnimator.ofInt(this, "scrollY", 0, 0); private PointerEvents mPointerEvents = PointerEvents.AUTO; private long mLastScrollDispatchTime = 0; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.kt index a3f23803dd6..427ddde7673 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.kt @@ -331,25 +331,9 @@ public object ReactScrollViewHelper { val scrollPos = scrollState.lastStateUpdateScroll val scrollX = scrollPos.x val scrollY = scrollPos.y - val layoutDirection = scrollState.layoutDirection - val fabricScrollX = - if (layoutDirection == View.LAYOUT_DIRECTION_RTL) { - // getScrollX returns offset from left even when layout direction is RTL. - // The following line calculates offset from right. - val child = scrollView.getChildAt(0) - val contentWidth = child?.width ?: 0 - -(contentWidth - scrollX - scrollView.width) - } else { - scrollX - } if (DEBUG_MODE) { FLog.i( - TAG, - "updateFabricScrollState[%d] scrollX %d scrollY %d fabricScrollX %d", - scrollView.id, - scrollX, - scrollY, - fabricScrollX) + TAG, "updateFabricScrollState[%d] scrollX %d scrollY %d", scrollView.id, scrollX, scrollY) } val stateWrapper = scrollView.stateWrapper if (stateWrapper != null) { @@ -507,13 +491,7 @@ public object ReactScrollViewHelper { } } - public class ReactScrollViewScrollState( - /** - * Get the layout direction. Can be either scrollView.LAYOUT_DIRECTION_RTL (1) or - * scrollView.LAYOUT_DIRECTION_LTR (0). If the value is -1, it means unknown layout. - */ - public val layoutDirection: Int - ) { + public class ReactScrollViewScrollState() { /** Get the position after current animation is finished */ public val finalAnimatedPositionScroll: Point = Point() diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp index dc75888a0ab..f2e2ad7124c 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp @@ -63,9 +63,7 @@ inline int getIntBufferSizeForType(CppMountItem::Type mountItemType) { case CppMountItem::Type::UpdatePadding: return 5; // tag, top, left, bottom, right case CppMountItem::Type::UpdateLayout: - return ReactNativeFeatureFlags::setAndroidLayoutDirection() - ? 8 // tag, parentTag, x, y, w, h, DisplayType, LayoutDirection - : 7; // tag, parentTag, x, y, w, h, DisplayType + return 8; // tag, parentTag, x, y, w, h, DisplayType, LayoutDirection case CppMountItem::Type::UpdateOverflowInset: return 5; // tag, left, top, right, bottom case CppMountItem::Undefined: @@ -377,26 +375,15 @@ inline void writeUpdateLayoutMountItem( int w = round(scale(frame.size.width, pointScaleFactor)); int h = round(scale(frame.size.height, pointScaleFactor)); - if (ReactNativeFeatureFlags::setAndroidLayoutDirection()) { - buffer.writeIntArray(std::array{ - mountItem.newChildShadowView.tag, - mountItem.parentShadowView.tag, - x, - y, - w, - h, - toInt(layoutMetrics.displayType), - toInt(layoutMetrics.layoutDirection)}); - } else { - buffer.writeIntArray(std::array{ - mountItem.newChildShadowView.tag, - mountItem.parentShadowView.tag, - x, - y, - w, - h, - toInt(layoutMetrics.displayType)}); - } + buffer.writeIntArray(std::array{ + mountItem.newChildShadowView.tag, + mountItem.parentShadowView.tag, + x, + y, + w, + h, + toInt(layoutMetrics.displayType), + toInt(layoutMetrics.layoutDirection)}); } inline void writeUpdateEventEmitterMountItem( 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 71b4e8b15d9..96feab5a89d 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<<17da000ed077668a52a4dacba88162b0>> + * @generated SignedSource<> */ /** @@ -249,12 +249,6 @@ class ReactNativeFeatureFlagsProviderHolder return method(javaProvider_); } - bool setAndroidLayoutDirection() override { - static const auto method = - getReactNativeFeatureFlagsProviderJavaClass()->getMethod("setAndroidLayoutDirection"); - return method(javaProvider_); - } - bool traceTurboModulePromiseRejectionsOnAndroid() override { static const auto method = getReactNativeFeatureFlagsProviderJavaClass()->getMethod("traceTurboModulePromiseRejectionsOnAndroid"); @@ -494,11 +488,6 @@ bool JReactNativeFeatureFlagsCxxInterop::loadVectorDrawablesOnImages( return ReactNativeFeatureFlags::loadVectorDrawablesOnImages(); } -bool JReactNativeFeatureFlagsCxxInterop::setAndroidLayoutDirection( - facebook::jni::alias_ref /*unused*/) { - return ReactNativeFeatureFlags::setAndroidLayoutDirection(); -} - bool JReactNativeFeatureFlagsCxxInterop::traceTurboModulePromiseRejectionsOnAndroid( facebook::jni::alias_ref /*unused*/) { return ReactNativeFeatureFlags::traceTurboModulePromiseRejectionsOnAndroid(); @@ -685,9 +674,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() { makeNativeMethod( "loadVectorDrawablesOnImages", JReactNativeFeatureFlagsCxxInterop::loadVectorDrawablesOnImages), - makeNativeMethod( - "setAndroidLayoutDirection", - JReactNativeFeatureFlagsCxxInterop::setAndroidLayoutDirection), makeNativeMethod( "traceTurboModulePromiseRejectionsOnAndroid", JReactNativeFeatureFlagsCxxInterop::traceTurboModulePromiseRejectionsOnAndroid), 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 44472c490d5..64ee9814067 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<<20fa39ef7b31222a0a34e131d60e6bec>> + * @generated SignedSource<<0b07eaeba8112f65ecb18d53b7b893af>> */ /** @@ -135,9 +135,6 @@ class JReactNativeFeatureFlagsCxxInterop static bool loadVectorDrawablesOnImages( facebook::jni::alias_ref); - static bool setAndroidLayoutDirection( - facebook::jni::alias_ref); - static bool traceTurboModulePromiseRejectionsOnAndroid( 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 0d177c58893..d29743cf022 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<> + * @generated SignedSource<<90e3ea3abb6f13c711aec3754ab03126>> */ /** @@ -166,10 +166,6 @@ bool ReactNativeFeatureFlags::loadVectorDrawablesOnImages() { return getAccessor().loadVectorDrawablesOnImages(); } -bool ReactNativeFeatureFlags::setAndroidLayoutDirection() { - return getAccessor().setAndroidLayoutDirection(); -} - bool ReactNativeFeatureFlags::traceTurboModulePromiseRejectionsOnAndroid() { return getAccessor().traceTurboModulePromiseRejectionsOnAndroid(); } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h index b328d648b36..4741f6b81e9 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<<0c0217362f582ac635d5f46347e65252>> + * @generated SignedSource<<4544b1e206765808859ef84c2e6333a9>> */ /** @@ -214,11 +214,6 @@ class ReactNativeFeatureFlags { */ RN_EXPORT static bool loadVectorDrawablesOnImages(); - /** - * Propagate layout direction to Android views. - */ - RN_EXPORT static bool setAndroidLayoutDirection(); - /** * Enables storing js caller stack when creating promise in native module. This is useful in case of Promise rejection and tracing the cause. */ diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp index 6ec0760b67d..e7db4367dc9 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<> + * @generated SignedSource<> */ /** @@ -659,24 +659,6 @@ bool ReactNativeFeatureFlagsAccessor::loadVectorDrawablesOnImages() { return flagValue.value(); } -bool ReactNativeFeatureFlagsAccessor::setAndroidLayoutDirection() { - auto flagValue = setAndroidLayoutDirection_.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(35, "setAndroidLayoutDirection"); - - flagValue = currentProvider_->setAndroidLayoutDirection(); - setAndroidLayoutDirection_ = flagValue; - } - - return flagValue.value(); -} - bool ReactNativeFeatureFlagsAccessor::traceTurboModulePromiseRejectionsOnAndroid() { auto flagValue = traceTurboModulePromiseRejectionsOnAndroid_.load(); @@ -686,7 +668,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(36, "traceTurboModulePromiseRejectionsOnAndroid"); + markFlagAsAccessed(35, "traceTurboModulePromiseRejectionsOnAndroid"); flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid(); traceTurboModulePromiseRejectionsOnAndroid_ = flagValue; @@ -704,7 +686,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(37, "useAlwaysAvailableJSErrorHandling"); + markFlagAsAccessed(36, "useAlwaysAvailableJSErrorHandling"); flagValue = currentProvider_->useAlwaysAvailableJSErrorHandling(); useAlwaysAvailableJSErrorHandling_ = flagValue; @@ -722,7 +704,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(38, "useFabricInterop"); + markFlagAsAccessed(37, "useFabricInterop"); flagValue = currentProvider_->useFabricInterop(); useFabricInterop_ = flagValue; @@ -740,7 +722,7 @@ bool ReactNativeFeatureFlagsAccessor::useImmediateExecutorInAndroidBridgeless() // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(39, "useImmediateExecutorInAndroidBridgeless"); + markFlagAsAccessed(38, "useImmediateExecutorInAndroidBridgeless"); flagValue = currentProvider_->useImmediateExecutorInAndroidBridgeless(); useImmediateExecutorInAndroidBridgeless_ = flagValue; @@ -758,7 +740,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(40, "useNativeViewConfigsInBridgelessMode"); + markFlagAsAccessed(39, "useNativeViewConfigsInBridgelessMode"); flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode(); useNativeViewConfigsInBridgelessMode_ = flagValue; @@ -776,7 +758,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimisedViewPreallocationOnAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(41, "useOptimisedViewPreallocationOnAndroid"); + markFlagAsAccessed(40, "useOptimisedViewPreallocationOnAndroid"); flagValue = currentProvider_->useOptimisedViewPreallocationOnAndroid(); useOptimisedViewPreallocationOnAndroid_ = flagValue; @@ -794,7 +776,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimizedEventBatchingOnAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(42, "useOptimizedEventBatchingOnAndroid"); + markFlagAsAccessed(41, "useOptimizedEventBatchingOnAndroid"); flagValue = currentProvider_->useOptimizedEventBatchingOnAndroid(); useOptimizedEventBatchingOnAndroid_ = flagValue; @@ -812,7 +794,7 @@ bool ReactNativeFeatureFlagsAccessor::useRuntimeShadowNodeReferenceUpdate() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(43, "useRuntimeShadowNodeReferenceUpdate"); + markFlagAsAccessed(42, "useRuntimeShadowNodeReferenceUpdate"); flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdate(); useRuntimeShadowNodeReferenceUpdate_ = flagValue; @@ -830,7 +812,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(44, "useTurboModuleInterop"); + markFlagAsAccessed(43, "useTurboModuleInterop"); flagValue = currentProvider_->useTurboModuleInterop(); useTurboModuleInterop_ = flagValue; @@ -848,7 +830,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(45, "useTurboModules"); + markFlagAsAccessed(44, "useTurboModules"); flagValue = currentProvider_->useTurboModules(); useTurboModules_ = flagValue; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h index 584021d15c3..356406a8a22 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<<6f11d494553e3f12b2ca326a880746f3>> */ /** @@ -67,7 +67,6 @@ class ReactNativeFeatureFlagsAccessor { bool initEagerTurboModulesOnNativeModulesQueueAndroid(); bool lazyAnimationCallbacks(); bool loadVectorDrawablesOnImages(); - bool setAndroidLayoutDirection(); bool traceTurboModulePromiseRejectionsOnAndroid(); bool useAlwaysAvailableJSErrorHandling(); bool useFabricInterop(); @@ -89,7 +88,7 @@ class ReactNativeFeatureFlagsAccessor { std::unique_ptr currentProvider_; bool wasOverridden_; - std::array, 46> accessedFeatureFlags_; + std::array, 45> accessedFeatureFlags_; std::atomic> commonTestFlag_; std::atomic> completeReactInstanceCreationOnBgThreadOnAndroid_; @@ -126,7 +125,6 @@ class ReactNativeFeatureFlagsAccessor { std::atomic> initEagerTurboModulesOnNativeModulesQueueAndroid_; std::atomic> lazyAnimationCallbacks_; std::atomic> loadVectorDrawablesOnImages_; - std::atomic> setAndroidLayoutDirection_; std::atomic> traceTurboModulePromiseRejectionsOnAndroid_; std::atomic> useAlwaysAvailableJSErrorHandling_; std::atomic> useFabricInterop_; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h index 2f7d939f28d..aced92bb667 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<<0f27ce54a52c9fbefa1a8b55a291d07e>> + * @generated SignedSource<<213e1ad83360a79e27d41c06e20fb8c9>> */ /** @@ -167,10 +167,6 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider { return false; } - bool setAndroidLayoutDirection() override { - return true; - } - bool traceTurboModulePromiseRejectionsOnAndroid() override { return false; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h index 7482706a766..56e018a3ad3 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<<7e933dbc3a9b39a024de073288397430>> + * @generated SignedSource<<5b2b2aba574e77851ad214809ead9228>> */ /** @@ -60,7 +60,6 @@ class ReactNativeFeatureFlagsProvider { virtual bool initEagerTurboModulesOnNativeModulesQueueAndroid() = 0; virtual bool lazyAnimationCallbacks() = 0; virtual bool loadVectorDrawablesOnImages() = 0; - virtual bool setAndroidLayoutDirection() = 0; virtual bool traceTurboModulePromiseRejectionsOnAndroid() = 0; virtual bool useAlwaysAvailableJSErrorHandling() = 0; virtual bool useFabricInterop() = 0; diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp index 869e395b978..17c6638f988 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<<4fe3b8f579c6db6093e4b1b732bd392a>> + * @generated SignedSource<> */ /** @@ -219,11 +219,6 @@ bool NativeReactNativeFeatureFlags::loadVectorDrawablesOnImages( return ReactNativeFeatureFlags::loadVectorDrawablesOnImages(); } -bool NativeReactNativeFeatureFlags::setAndroidLayoutDirection( - jsi::Runtime& /*runtime*/) { - return ReactNativeFeatureFlags::setAndroidLayoutDirection(); -} - bool NativeReactNativeFeatureFlags::traceTurboModulePromiseRejectionsOnAndroid( jsi::Runtime& /*runtime*/) { return ReactNativeFeatureFlags::traceTurboModulePromiseRejectionsOnAndroid(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h index ea25880d1da..0a7ab35143a 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<<895944e81ecdf7f1df63bfa9ebe52b13>> + * @generated SignedSource<> */ /** @@ -107,8 +107,6 @@ class NativeReactNativeFeatureFlags bool loadVectorDrawablesOnImages(jsi::Runtime& runtime); - bool setAndroidLayoutDirection(jsi::Runtime& runtime); - bool traceTurboModulePromiseRejectionsOnAndroid(jsi::Runtime& runtime); bool useAlwaysAvailableJSErrorHandling(jsi::Runtime& runtime); diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index e59e308a13c..541530b603d 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -343,14 +343,6 @@ const definitions: FeatureFlagDefinitions = { purpose: 'experimentation', }, }, - setAndroidLayoutDirection: { - defaultValue: true, - metadata: { - dateAdded: '2024-05-17', - description: 'Propagate layout direction to Android views.', - purpose: 'experimentation', - }, - }, traceTurboModulePromiseRejectionsOnAndroid: { defaultValue: false, metadata: { diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index b29d0272a94..bed5d9990a4 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<> + * @generated SignedSource<> * @flow strict */ @@ -87,7 +87,6 @@ export type ReactNativeFeatureFlags = { initEagerTurboModulesOnNativeModulesQueueAndroid: Getter, lazyAnimationCallbacks: Getter, loadVectorDrawablesOnImages: Getter, - setAndroidLayoutDirection: Getter, traceTurboModulePromiseRejectionsOnAndroid: Getter, useAlwaysAvailableJSErrorHandling: Getter, useFabricInterop: Getter, @@ -334,10 +333,6 @@ export const lazyAnimationCallbacks: Getter = createNativeFlagGetter('l * Adds support for loading vector drawable assets in the Image component (only on Android) */ export const loadVectorDrawablesOnImages: Getter = createNativeFlagGetter('loadVectorDrawablesOnImages', false); -/** - * Propagate layout direction to Android views. - */ -export const setAndroidLayoutDirection: Getter = createNativeFlagGetter('setAndroidLayoutDirection', true); /** * Enables storing js caller stack when creating promise in native module. This is useful in case of Promise rejection and tracing the cause. */ diff --git a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js index 26a02e75a89..fd1a263893b 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<> + * @generated SignedSource<<4caaf5dbaa68614ce53c8aecbd512df8>> * @flow strict */ @@ -59,7 +59,6 @@ export interface Spec extends TurboModule { +initEagerTurboModulesOnNativeModulesQueueAndroid?: () => boolean; +lazyAnimationCallbacks?: () => boolean; +loadVectorDrawablesOnImages?: () => boolean; - +setAndroidLayoutDirection?: () => boolean; +traceTurboModulePromiseRejectionsOnAndroid?: () => boolean; +useAlwaysAvailableJSErrorHandling?: () => boolean; +useFabricInterop?: () => boolean;