Undo a breaking change with I18nUtil.instance (#45390)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45390

This undos a breaking change with I18nUtil for Kotlin consumer.
I've re-added a `getInstance` method so that Kotlin libraries won't break.
The method is added as Deprecated as those libraries need to migrate to `.instance`
accessors as more idiomatic.

Changelog:
[Android] [Fixed] - Undo a breaking change with I18nUtil.instance

Reviewed By: alanleedev

Differential Revision: D59638044

fbshipit-source-id: 1c93a98676b5b01e89be3b974961c5f3ae919511
This commit is contained in:
Nicola Corti
2024-07-15 14:29:28 +01:00
committed by Blake Friedman
parent 50643a300c
commit b8b9e9ee7d
2 changed files with 12 additions and 0 deletions
@@ -3397,6 +3397,7 @@ public final class com/facebook/react/modules/i18nmanager/I18nUtil {
}
public final class com/facebook/react/modules/i18nmanager/I18nUtil$Companion {
public final fun DEPRECATED$getInstance ()Lcom/facebook/react/modules/i18nmanager/I18nUtil;
public final fun getInstance ()Lcom/facebook/react/modules/i18nmanager/I18nUtil;
}
@@ -86,5 +86,16 @@ public class I18nUtil private constructor() {
private const val KEY_FOR_PREFS_FORCERTL = "RCTI18nUtil_forceRTL"
private const val KEY_FOR_PERFS_MAKE_RTL_FLIP_LEFT_AND_RIGHT_STYLES =
"RCTI18nUtil_makeRTLFlipLeftAndRightStyles"
/**
* We're just re-adding this to reduce a breaking change for libraries in React Native 0.75.
*
* @deprecated Use instance instead
*/
@Deprecated(
"Use .instance instead, this API is only for backward compat", ReplaceWith("instance"))
@JvmName(
"DEPRECATED\$getInstance") // We intentionally don't want to expose this accessor to Java.
public fun getInstance(): I18nUtil = instance
}
}