Fix bad merge of I18nUtil (#44600)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
Nick Gerleman
2024-05-17 06:20:29 -07:00
committed by Facebook GitHub Bot
parent 355fe7717c
commit 044aadbaf6
2 changed files with 2 additions and 8 deletions
@@ -3351,7 +3351,6 @@ public final class com/facebook/react/modules/i18nmanager/I18nUtil {
public final fun doLeftAndRightSwapInRTL (Landroid/content/Context;)Z
public final fun forceRTL (Landroid/content/Context;Z)V
public static final fun getInstance ()Lcom/facebook/react/modules/i18nmanager/I18nUtil;
public final fun hasRtlSupport (Landroid/content/Context;)Z
public final fun isRTL (Landroid/content/Context;)Z
public final fun swapLeftAndRightInRTL (Landroid/content/Context;Z)V
}
@@ -20,9 +20,8 @@ public class I18nUtil private constructor() {
* * allows RTL layout when using RTL locale
*/
public fun isRTL(context: Context): Boolean =
if (isRTLForced(context)) {
true
} else isRTLAllowed(context) && isDevicePreferredLanguageRTL
applicationHasRtlSupport(context) &&
(isRTLForced(context) || (isRTLAllowed(context) && isDevicePreferredLanguageRTL))
/**
* Android relies on the presence of `android:supportsRtl="true"` being set in order to resolve
@@ -33,10 +32,6 @@ public class I18nUtil private constructor() {
return (context.getApplicationInfo().flags and ApplicationInfo.FLAG_SUPPORTS_RTL) != 0
}
public fun hasRtlSupport(context: Context): Boolean {
return applicationHasRtlSupport(context) || isRTLAllowed(context)
}
/**
* Should be used very early during app start up Before the bridge is initialized
*