Skip to content

Commit 3244a5e

Browse files
alanleedevfacebook-github-bot
authored andcommitted
code cleanup for depreacted OS version (facebook#46390)
Summary: Pull Request resolved: facebook#46390 As React Native's minSdkVersion is not 24, clean up version checks and code that is using deprecated version from OSS Changelog: [Internal] - code cleanup for minSdkVersion 24 Reviewed By: philIip Differential Revision: D62362059 fbshipit-source-id: a851d0908d4175269524f41955acca5f2da69cad
1 parent d424c24 commit 3244a5e

File tree

2 files changed

+25
-31
lines changed

2 files changed

+25
-31
lines changed

packages/react-native-popup-menu-android/android/src/main/java/com/facebook/react/popupmenu/ReactPopupMenuContainer.kt

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,34 +24,32 @@ public class ReactPopupMenuContainer(context: Context) : FrameLayout(context) {
2424
}
2525

2626
public fun showPopupMenu() {
27-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
28-
val view = getChildAt(0)
29-
val popupMenu = PopupMenu(context, view)
30-
var menu = popupMenu.menu
31-
val items = menuItems
32-
if (items != null) {
33-
for (i in 0 until items.size()) {
34-
menu.add(Menu.NONE, Menu.NONE, i, items.getString(i))
35-
}
27+
val view = getChildAt(0)
28+
val popupMenu = PopupMenu(context, view)
29+
var menu = popupMenu.menu
30+
val items = menuItems
31+
if (items != null) {
32+
for (i in 0 until items.size()) {
33+
menu.add(Menu.NONE, Menu.NONE, i, items.getString(i))
3634
}
37-
popupMenu.setOnMenuItemClickListener { menuItem ->
38-
val reactContext = context as ReactContext
39-
val eventDispatcher = UIManagerHelper.getEventDispatcherForReactTag(reactContext, id)
40-
if (eventDispatcher != null) {
41-
val surfaceId = UIManagerHelper.getSurfaceId(reactContext)
42-
eventDispatcher.dispatchEvent(PopupMenuSelectionEvent(surfaceId, id, menuItem.order))
43-
}
44-
true
35+
}
36+
popupMenu.setOnMenuItemClickListener { menuItem ->
37+
val reactContext = context as ReactContext
38+
val eventDispatcher = UIManagerHelper.getEventDispatcherForReactTag(reactContext, id)
39+
if (eventDispatcher != null) {
40+
val surfaceId = UIManagerHelper.getSurfaceId(reactContext)
41+
eventDispatcher.dispatchEvent(PopupMenuSelectionEvent(surfaceId, id, menuItem.order))
4542
}
46-
popupMenu.setOnDismissListener {
47-
val reactContext = context as ReactContext
48-
val eventDispatcher = UIManagerHelper.getEventDispatcherForReactTag(reactContext, id)
49-
if (eventDispatcher != null) {
50-
val surfaceId = UIManagerHelper.getSurfaceId(reactContext)
51-
eventDispatcher.dispatchEvent(PopupMenuDismissEvent(surfaceId, id))
52-
}
43+
true
44+
}
45+
popupMenu.setOnDismissListener {
46+
val reactContext = context as ReactContext
47+
val eventDispatcher = UIManagerHelper.getEventDispatcherForReactTag(reactContext, id)
48+
if (eventDispatcher != null) {
49+
val surfaceId = UIManagerHelper.getSurfaceId(reactContext)
50+
eventDispatcher.dispatchEvent(PopupMenuDismissEvent(surfaceId, id))
5351
}
54-
popupMenu.show()
5552
}
53+
popupMenu.show()
5654
}
5755
}

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nManagerModule.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,8 @@ import com.facebook.react.module.annotations.ReactModule
1717
public class I18nManagerModule(context: ReactApplicationContext?) : NativeI18nManagerSpec(context) {
1818
override public fun getTypedExportedConstants(): Map<String, Any> {
1919
val context = getReactApplicationContext()
20-
val locale =
21-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
22-
context.resources.configuration.locales[0]
23-
} else {
24-
@Suppress("DEPRECATION") context.resources.configuration.locale
25-
}
20+
val locale = context.resources.configuration.locales[0]
21+
2622
return mapOf(
2723
"isRTL" to I18nUtil.instance.isRTL(context),
2824
"doLeftAndRightSwapInRTL" to I18nUtil.instance.doLeftAndRightSwapInRTL(context),

0 commit comments

Comments
 (0)