Skip to content

Commit 044aadb

Browse files
NickGerlemanfacebook-github-bot
authored andcommitted
Fix bad merge of I18nUtil (#44600)
Summary: Pull Request resolved: #44600 I didn't pay close enough attention during merge between V1 and V2 of D57248205, and what I ultimately checked in is not correct. Fix the logic here. Changelog: [Internal] Reviewed By: yungsters Differential Revision: D57488372 fbshipit-source-id: c9db597a6ae4ca5ae81e6ccd9913a14be268dd57
1 parent 355fe77 commit 044aadb

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3351,7 +3351,6 @@ public final class com/facebook/react/modules/i18nmanager/I18nUtil {
33513351
public final fun doLeftAndRightSwapInRTL (Landroid/content/Context;)Z
33523352
public final fun forceRTL (Landroid/content/Context;Z)V
33533353
public static final fun getInstance ()Lcom/facebook/react/modules/i18nmanager/I18nUtil;
3354-
public final fun hasRtlSupport (Landroid/content/Context;)Z
33553354
public final fun isRTL (Landroid/content/Context;)Z
33563355
public final fun swapLeftAndRightInRTL (Landroid/content/Context;Z)V
33573356
}

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.kt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ public class I18nUtil private constructor() {
2020
* * allows RTL layout when using RTL locale
2121
*/
2222
public fun isRTL(context: Context): Boolean =
23-
if (isRTLForced(context)) {
24-
true
25-
} else isRTLAllowed(context) && isDevicePreferredLanguageRTL
23+
applicationHasRtlSupport(context) &&
24+
(isRTLForced(context) || (isRTLAllowed(context) && isDevicePreferredLanguageRTL))
2625

2726
/**
2827
* Android relies on the presence of `android:supportsRtl="true"` being set in order to resolve
@@ -33,10 +32,6 @@ public class I18nUtil private constructor() {
3332
return (context.getApplicationInfo().flags and ApplicationInfo.FLAG_SUPPORTS_RTL) != 0
3433
}
3534

36-
public fun hasRtlSupport(context: Context): Boolean {
37-
return applicationHasRtlSupport(context) || isRTLAllowed(context)
38-
}
39-
4035
/**
4136
* Should be used very early during app start up Before the bridge is initialized
4237
*

0 commit comments

Comments
 (0)