Skip to content

Commit

Permalink
Reenable setAndroidLayoutDirection by default (#46811)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Oct 3, 2024
1 parent 060c594 commit 6cf0cfb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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>>
*/

/**
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>>
*/

/**
Expand Down Expand Up @@ -176,7 +176,7 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
}

bool setAndroidLayoutDirection() override {
return false;
return true;
}

bool traceTurboModulePromiseRejectionsOnAndroid() override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ const definitions: FeatureFlagDefinitions = {
},
},
setAndroidLayoutDirection: {
defaultValue: false,
defaultValue: true,
metadata: {
dateAdded: '2024-05-17',
description: 'Propagate layout direction to Android views.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/

Expand Down Expand Up @@ -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.
*/
Expand Down

0 comments on commit 6cf0cfb

Please sign in to comment.