Skip to content

Commit

Permalink
Undo a breaking change with I18nUtil.instance (#45390)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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
  • Loading branch information
cortinico authored and facebook-github-bot committed Jul 11, 2024
1 parent b24d47a commit 221755c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -3391,6 +3391,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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

0 comments on commit 221755c

Please sign in to comment.