Reenable setAndroidLayoutDirection by default (#46811)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46811

I turned this off a few weeks after we turned off in FB app in (D60273063), after discovering it defeated a check used to disable `removeClippedSubviews` in RTL (reintroducing its bugged behavior).

D63318754 fixed that bug, so this is turning back on by default. This is also needed to fix border rendering direction bug introduced in BackgroundStyleApplicator in views where the contextual layout direction is different from the root Android layout direction (either because of `direction`, or `I18nManager` forceRTL). This fixes some existing RNTester RTL screenshot test failures which are hooked via forceRTL.

This also fixes rendering of some native components like `Switch` which would previously not respect contextual direction.

Changelog:
[Android][Fixed] - Reenable `setAndroidLayoutDirection` by default

Reviewed By: javache

Differential Revision: D63815077

fbshipit-source-id: fea64191d83d366c6bfc7b8c58b215773c8e8efe
This commit is contained in:
Nick Gerleman
2024-10-03 10:41:59 -07:00
committed by Facebook GitHub Bot
parent 060c594457
commit 6cf0cfb5a4
4 changed files with 7 additions and 7 deletions
@@ -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<<01fab77f1ec0e0bf3c7d8c894bb558bc>>
* @generated SignedSource<<fdfe7360e02f319b1bae54c52e2bdf0b>>
*/
/**
@@ -97,7 +97,7 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun removeNestedCallsToDispatchMountItemsOnAndroid(): Boolean = false
override fun setAndroidLayoutDirection(): Boolean = false
override fun setAndroidLayoutDirection(): Boolean = true
override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean = false
@@ -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<<37c9fda4f1bc361bde3ba3fce8f18eb9>>
* @generated SignedSource<<bae4296b2dc7665b26622ce379b4bd3b>>
*/
/**
@@ -176,7 +176,7 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
}
bool setAndroidLayoutDirection() override {
return false;
return true;
}
bool traceTurboModulePromiseRejectionsOnAndroid() override {
@@ -355,7 +355,7 @@ const definitions: FeatureFlagDefinitions = {
},
},
setAndroidLayoutDirection: {
defaultValue: false,
defaultValue: true,
metadata: {
dateAdded: '2024-05-17',
description: 'Propagate layout direction to Android views.',
@@ -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<<d55b5677cec27f850398f066c2908fa2>>
* @generated SignedSource<<a6f5238c0f123b0ede2b9de95bd98676>>
* @flow strict
*/
@@ -337,7 +337,7 @@ export const removeNestedCallsToDispatchMountItemsOnAndroid: Getter<boolean> = c
/**
* Propagate layout direction to Android views.
*/
export const setAndroidLayoutDirection: Getter<boolean> = createNativeFlagGetter('setAndroidLayoutDirection', false);
export const setAndroidLayoutDirection: Getter<boolean> = 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.
*/