Skip to content

Commit b04abac

Browse files
authored
fix: don't crash when no elements are found (#318)
* fix: don't crash when no elements are found * Create metal-rocks-shop.md
1 parent a8aa4aa commit b04abac

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/metal-rocks-shop.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-native-bottom-tabs": patch
3+
---
4+
5+
fix(android): don't crash when no elements are found

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)