Skip to content

Commit 3c61c1f

Browse files
committed
set the selected and unselected image, do not set on every change.
1 parent 043c650 commit 3c61c1f

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/tabs/tabs.ios.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -577,12 +577,12 @@ export class Tabs extends TabsBase {
577577
if (tabStripItems) {
578578
if (tabStripItems[newIndex]) {
579579
tabStripItems[newIndex]._emit(TabStripItem.selectEvent);
580-
this.updateItemColors(tabStripItems[newIndex]);
580+
// this.updateItemColors(tabStripItems[newIndex]);
581581
}
582582

583583
if (tabStripItems[oldIndex]) {
584584
tabStripItems[oldIndex]._emit(TabStripItem.unselectEvent);
585-
this.updateItemColors(tabStripItems[oldIndex]);
585+
// this.updateItemColors(tabStripItems[oldIndex]);
586586
}
587587
}
588588

@@ -1003,9 +1003,18 @@ export class Tabs extends TabsBase {
10031003
}
10041004

10051005
// if selectedItemColor or unSelectedItemColor is set we don't respect the color from the style
1006-
const tabStripColor = this.selectedIndex === tabStripItem._index ? this._selectedItemColor : this._unSelectedItemColor;
1007-
const image = this.getIcon(tabStripItem, tabStripColor);
1008-
tabStripItem.nativeView.image = image;
1006+
1007+
if(this._selectedItemColor){
1008+
const image = this.getIcon(tabStripItem, this._selectedItemColor);
1009+
tabStripItem.nativeView.selectedImage = image;
1010+
1011+
}
1012+
1013+
if(this._unSelectedItemColor){
1014+
const image = this.getIcon(tabStripItem, this._unSelectedItemColor);
1015+
tabStripItem.nativeView.image = image;
1016+
}
1017+
10091018
}
10101019

10111020
public setTabBarIconColor(tabStripItem: TabStripItem, value: UIColor | Color): void {

0 commit comments

Comments
 (0)