Skip to content

Commit be266df

Browse files
authored
fix: show small badge on Android when passing empty space (#438)
1 parent 28282f4 commit be266df

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/shy-masks-accept.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: show small badge on Android when passing empty space

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,11 @@ class ReactBottomNavigationView(context: Context) : LinearLayout(context) {
248248
if (item.badge?.isNotEmpty() == true) {
249249
val badge = bottomNavigation.getOrCreateBadge(index)
250250
badge.isVisible = true
251-
badge.text = item.badge
251+
// Set the badge text only if it's different than an empty space to show a small badge.
252+
// More context: https://github.com/callstackincubator/react-native-bottom-tabs/issues/422
253+
if (item.badge != " ") {
254+
badge.text = item.badge
255+
}
252256
} else {
253257
bottomNavigation.removeBadge(index)
254258
}

0 commit comments

Comments
 (0)