@@ -486,22 +486,20 @@ export class BottomNavigation extends TabNavigationBase {
486
486
items . forEach ( ( item , i ) => {
487
487
const controller = this . getViewController ( item ) ;
488
488
489
- let icon = null ;
490
- let title = "" ;
491
-
492
489
if ( this . tabStrip && this . tabStrip . items && this . tabStrip . items [ i ] ) {
493
- const tabStripItem = < TabStripItem > this . tabStrip . items [ i ] ;
494
- icon = this . _getIcon ( tabStripItem . iconSource ) ;
495
- title = tabStripItem . title ;
496
-
497
- const tabBarItem = UITabBarItem . alloc ( ) . initWithTitleImageTag ( ( title || "" ) , icon , i ) ;
498
- updateTitleAndIconPositions ( tabStripItem , tabBarItem , controller ) ;
490
+ const item = < TabStripItem > this . tabStrip . items [ i ] ;
491
+ const tabBarItem = this . createTabBarItem ( item , i ) ;
492
+ updateTitleAndIconPositions ( item , tabBarItem , controller ) ;
499
493
500
494
applyStatesToItem ( tabBarItem , states ) ;
501
495
502
496
controller . tabBarItem = tabBarItem ;
497
+ < < < << << HEAD
503
498
( < any > tabStripItem ) . index = i ;
504
499
tabStripItem . setNativeView ( tabBarItem ) ;
500
+ === = ===
501
+ item . setNativeView ( tabBarItem ) ;
502
+ >>> > >>> feat ( ios - bottom - navigation ) : create tab bar from image nad label
505
503
}
506
504
507
505
controllers . addObject ( controller ) ;
@@ -514,6 +512,20 @@ export class BottomNavigation extends TabNavigationBase {
514
512
this . _ios . moreNavigationController . delegate = this . _moreNavigationControllerDelegate ;
515
513
}
516
514
515
+ private createTabBarItem ( item : TabStripItem , index : number ) : UITabBarItem {
516
+ let image : UIImage ;
517
+ let title : string ;
518
+
519
+ // Image and Label children of TabStripItem
520
+ // take priority over its `iconSource` and `title` properties
521
+ image = item . image ? this . _getIcon ( item . image . src ) : this . _getIcon ( item . iconSource ) ;
522
+ title = item . label ? item . label . text : item . title ;
523
+
524
+ const tabBarItem = UITabBarItem . alloc ( ) . initWithTitleImageTag ( title , image , index ) ;
525
+
526
+ return tabBarItem ;
527
+ }
528
+
517
529
private _getIconRenderingMode ( ) : UIImageRenderingMode {
518
530
return UIImageRenderingMode . AlwaysOriginal ;
519
531
}
@@ -611,4 +623,4 @@ function getTitleAttributesForStates(view: View): TabStates {
611
623
function applyStatesToItem ( item : UITabBarItem , states : TabStates ) {
612
624
item . setTitleTextAttributesForState ( states . normalState , UIControlState . Normal ) ;
613
625
item . setTitleTextAttributesForState ( states . selectedState , UIControlState . Selected ) ;
614
- }
626
+ }
0 commit comments