@@ -34,6 +34,7 @@ export interface TabSelectedEventData extends EventData {
34
34
export interface TabReselectedEventData extends EventData {
35
35
index : number ;
36
36
}
37
+
37
38
/**
38
39
* Enum for Title Visibility options
39
40
*
@@ -59,6 +60,7 @@ export abstract class BottomNavigationBarBase extends View {
59
60
60
61
selectedTabIndex = 0 ;
61
62
titleVisibility : TitleVisibility = TitleVisibility . always ;
63
+ autoClearBadge : boolean ;
62
64
63
65
protected _items : BottomNavigationTabBase [ ] = [ ] ;
64
66
@@ -89,7 +91,10 @@ export abstract class BottomNavigationBarBase extends View {
89
91
index,
90
92
} ;
91
93
this . notify ( eventData ) ;
92
- this . removeBadge ( index ) ;
94
+
95
+ if ( this . autoClearBadge ) {
96
+ this . removeBadge ( index ) ;
97
+ }
93
98
}
94
99
95
100
_emitTabSelected ( index : number ) {
@@ -101,7 +106,10 @@ export abstract class BottomNavigationBarBase extends View {
101
106
} ;
102
107
this . selectedTabIndex = index ;
103
108
this . notify ( eventData ) ;
104
- this . removeBadge ( index ) ;
109
+
110
+ if ( this . autoClearBadge ) {
111
+ this . removeBadge ( index ) ;
112
+ }
105
113
}
106
114
107
115
_emitTabReselected ( index : number ) {
@@ -150,6 +158,14 @@ export const titleVisibilityProperty = new Property<BottomNavigationBarBase, Tit
150
158
151
159
titleVisibilityProperty . register ( BottomNavigationBarBase ) ;
152
160
161
+ export const autoClearBadgeProperty = new Property < BottomNavigationBarBase , boolean > ( {
162
+ name : 'autoClearBadge' ,
163
+ defaultValue : true ,
164
+ valueConverter : booleanConverter ,
165
+ } ) ;
166
+
167
+ autoClearBadgeProperty . register ( BottomNavigationBarBase ) ;
168
+
153
169
export const activeColorCssProperty = new CssProperty < Style , Color > ( {
154
170
name : 'activeColor' ,
155
171
cssName : 'active-color' ,
0 commit comments