@@ -830,34 +830,24 @@ export abstract class TabNavigation<
830
830
831
831
private setItemColors ( ) : void {
832
832
if ( this . mSelectedItemColor ) {
833
+ this . viewController . tabBar . setImageTintColorForState ( this . mSelectedItemColor . ios , UIControlState . Selected ) ;
833
834
this . viewController . tabBar . setTitleColorForState ( this . mSelectedItemColor . ios , UIControlState . Selected ) ;
834
835
}
835
836
if ( this . mUnSelectedItemColor ) {
837
+ this . viewController . tabBar . setImageTintColorForState ( this . mUnSelectedItemColor . ios , UIControlState . Normal ) ;
836
838
this . viewController . tabBar . setTitleColorForState ( this . mUnSelectedItemColor . ios , UIControlState . Normal ) ;
837
839
}
838
840
}
839
841
840
842
private setIconColor ( tabStripItem : TabStripItem , forceReload = false ) : void {
841
843
const nativeView = tabStripItem . nativeView ;
842
- if ( ! nativeView ) {
843
- return ;
844
- }
845
- // if there is no change in the css color and there is no item color set
846
- // we don't need to reload the icon
847
- if ( ! forceReload && ! this . mSelectedItemColor && ! this . mUnSelectedItemColor ) {
848
- return ;
849
- }
850
-
851
- // if selectedItemColor or unSelectedItemColor is set we don't respect the color from the style
844
+ if ( nativeView && ( forceReload || ( ! this . mUnSelectedItemColor && ! this . mSelectedItemColor ) ) ) {
845
+ // if selectedItemColor or unSelectedItemColor is set we don't respect the color from the style
846
+ const tabStripColor = this . selectedIndex === tabStripItem . index ? this . mSelectedItemColor : this . mUnSelectedItemColor ;
847
+ const image = this . getIcon ( tabStripItem , tabStripColor ) ;
852
848
853
- if ( this . mSelectedItemColor ) {
854
- const image = this . getIcon ( tabStripItem , this . mSelectedItemColor ) ;
855
- nativeView . selectedImage = image ;
856
- }
857
-
858
- if ( this . mUnSelectedItemColor ) {
859
- const image = this . getIcon ( tabStripItem , this . mUnSelectedItemColor ) ;
860
849
nativeView . image = image ;
850
+ nativeView . selectedImage = image ;
861
851
}
862
852
}
863
853
0 commit comments