Skip to content

Commit 3817bd0

Browse files
committed
fix: don't crash when no elements are found
1 parent a8aa4aa commit 3817bd0

File tree

1 file changed

+1
-1
lines changed
  • packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview

1 file changed

+1
-1
lines changed

packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview/RCTTabView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ class ReactBottomNavigationView(context: Context) : LinearLayout(context) {
423423

424424
private fun updateTintColors() {
425425
// First let's check current item color.
426-
val currentItemTintColor = items.first { it.key == selectedItem }.activeTintColor
426+
val currentItemTintColor = items.firstOrNull { it.key == selectedItem }?.activeTintColor
427427

428428
// getDefaultColor will always return a valid color but to satisfy the compiler we need to check for null
429429
val colorPrimary = currentItemTintColor ?: activeTintColor ?: Utils.getDefaultColorFor(

0 commit comments

Comments
 (0)