From 71f8d7608f8359a07da0ecb05ac86fe9041685ea Mon Sep 17 00:00:00 2001 From: Peng Jiang Date: Wed, 26 Jun 2024 01:47:24 -0700 Subject: [PATCH] use view.LAYOUT_DIRECTION_RTL directly (#45152) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45152 As the androidx.core 1.13.1 change, ViewCompat.LAYOUT_DIRECTION_RTL is deprecated. Based on the suggestion from https://developer.android.com/reference/androidx/core/view/ViewCompat#LAYOUT_DIRECTION_RTL(), use view LAYOUT_DIRECTION_RTL directly and they have the same value. {F1716960190} Changelog: [Internal] - Migrating deprecated APIs with AndroidX.Core 1.13.1 Reviewed By: alanleedev Differential Revision: D58953460 fbshipit-source-id: 938200d1d0b1c7cc167f0119cc20ba72d16351a4 --- .../java/com/facebook/react/modules/i18nmanager/I18nUtil.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 57347b30481..396a81d21e3 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 @@ -9,8 +9,8 @@ package com.facebook.react.modules.i18nmanager import android.content.Context import android.content.pm.ApplicationInfo +import android.view.View import androidx.core.text.TextUtilsCompat -import androidx.core.view.ViewCompat import java.util.Locale public class I18nUtil private constructor() { @@ -63,7 +63,7 @@ public class I18nUtil private constructor() { // Check if the current device language is RTL get() { val directionality = TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) - return directionality == ViewCompat.LAYOUT_DIRECTION_RTL + return directionality == View.LAYOUT_DIRECTION_RTL } private fun isPrefSet(context: Context, key: String, defaultValue: Boolean): Boolean =