@@ -27,23 +27,23 @@ class BottomNavigationBarDelegate extends NSObject {
27
27
if ( ! owner ) {
28
28
return ;
29
29
}
30
- const tag = item && item . tag ? item . tag : 0 ;
31
- if ( owner . selectedTabIndex === tag ) {
32
- owner . _emitTabReselected ( tag ) ;
30
+ const barIndex = item && ( item as any ) . barIndex ? ( item as any ) . barIndex : 0 ;
31
+ if ( owner . selectedTabIndex === barIndex ) {
32
+ owner . _emitTabReselected ( barIndex ) ;
33
33
return ;
34
34
}
35
- owner . _emitTabSelected ( tag ) ;
35
+ owner . _emitTabSelected ( barIndex ) ;
36
36
}
37
37
38
38
bottomNavigationBarShouldSelectItem ( bottomNavigationBar : MDCBottomNavigationBar , item : UITabBarItem ) : boolean {
39
39
const owner = this . _owner . get ( ) ;
40
40
if ( ! owner ) {
41
41
return true ;
42
42
}
43
- const tag = item && item . tag ? item . tag : 0 ;
44
- const bottomNavigationTab = owner . items [ tag ] ;
43
+ const barIndex = item && ( item as any ) . barIndex ? ( item as any ) . barIndex : 0 ;
44
+ const bottomNavigationTab = owner . items [ barIndex ] ;
45
45
if ( ! bottomNavigationTab . isSelectable ) {
46
- owner . _emitTabPressed ( tag ) ;
46
+ owner . _emitTabPressed ( barIndex ) ;
47
47
}
48
48
return bottomNavigationTab . isSelectable ;
49
49
}
@@ -144,15 +144,14 @@ export class BottomNavigationBar extends BottomNavigationBarBase {
144
144
if ( tabs ) {
145
145
this . _items = tabs ;
146
146
}
147
-
148
147
const bottomNavigationTabs = this . _items . map ( ( item , index ) => {
149
148
this . _addView ( item ) ;
150
149
const tab = item . nativeViewProtected ;
151
- tab . tag = index ;
150
+ ( tab as any ) . barIndex = index ;
152
151
return tab ;
153
152
} ) ;
154
153
this . nativeViewProtected . items = new NSArray ( { array : bottomNavigationTabs } ) ;
155
-
154
+
156
155
// TODO: this is for he v8 runtime. Should not have to need this setTimeout(), find better way.
157
156
setTimeout ( ( ) => {
158
157
this . nativeViewProtected . selectedItem = this . nativeViewProtected . items [ this . selectedTabIndex ] ;
0 commit comments