diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.kt index dd42a4bc5fa501..1968ec99bd5327 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.kt @@ -8,6 +8,7 @@ package com.facebook.react.modules.i18nmanager import android.content.Context +import android.content.pm.ApplicationInfo import androidx.core.text.TextUtilsCompat import androidx.core.view.ViewCompat import java.util.Locale @@ -23,6 +24,19 @@ public class I18nUtil private constructor() { true } else isRTLAllowed(context) && isDevicePreferredLanguageRTL + /** + * Android relies on the presence of `android:supportsRtl="true"` being set in order to resolve + * RTL as a layout direction for native Android views. RTL in React Native relies on this being + * set. + */ + private fun applicationHasRtlSupport(context: Context): Boolean { + 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 * diff --git a/packages/react-native/template/android/app/src/main/AndroidManifest.xml b/packages/react-native/template/android/app/src/main/AndroidManifest.xml index 4122f36a590a44..e1892528b8d0b0 100644 --- a/packages/react-native/template/android/app/src/main/AndroidManifest.xml +++ b/packages/react-native/template/android/app/src/main/AndroidManifest.xml @@ -8,7 +8,8 @@ android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" - android:theme="@style/AppTheme"> + android:theme="@style/AppTheme" + android:supportsRtl="true"> + android:theme="@style/AppTheme" + android:supportsRtl="true">