mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(tabs): dynamic styling fixes - iconSource
selectedItemColor and unSelectedItemColor
This commit is contained in:
@@ -844,18 +844,19 @@ export class Tabs extends TabsBase {
|
||||
this.setItemsColors(this.tabStrip.items);
|
||||
}
|
||||
|
||||
public setTabBarItemTitle(tabStripItem: TabStripItem, value: string): void {
|
||||
private updateItem(tabStripItem: TabStripItem): void {
|
||||
// TODO: Should figure out a way to do it directly with the the nativeView
|
||||
const tabStripItemIndex = this.tabStrip.items.indexOf(tabStripItem);
|
||||
const tabItemSpec = this.createTabItemSpec(tabStripItem);
|
||||
this.updateAndroidItemAt(tabStripItemIndex, tabItemSpec);
|
||||
}
|
||||
|
||||
public setTabBarItemTitle(tabStripItem: TabStripItem, value: string): void {
|
||||
this.updateItem(tabStripItem);
|
||||
}
|
||||
|
||||
public setTabBarItemBackgroundColor(tabStripItem: TabStripItem, value: android.graphics.drawable.Drawable | Color): void {
|
||||
// TODO: Should figure out a way to do it directly with the the nativeView
|
||||
const tabStripItemIndex = this.tabStrip.items.indexOf(tabStripItem);
|
||||
const tabItemSpec = this.createTabItemSpec(tabStripItem);
|
||||
this.updateAndroidItemAt(tabStripItemIndex, tabItemSpec);
|
||||
this.updateItem(tabStripItem);
|
||||
}
|
||||
|
||||
public _setItemColor(tabStripItem: TabStripItem) {
|
||||
@@ -905,6 +906,10 @@ export class Tabs extends TabsBase {
|
||||
this.setIconColor(tabStripItem);
|
||||
}
|
||||
|
||||
public setTabBarIconSource(tabStripItem: TabStripItem, value: number | Color): void {
|
||||
this.updateItem(tabStripItem);
|
||||
}
|
||||
|
||||
public setTabBarItemFontInternal(tabStripItem: TabStripItem, value: Font): void {
|
||||
if (value.fontSize) {
|
||||
tabStripItem.nativeViewProtected.setTextSize(value.fontSize);
|
||||
|
||||
@@ -751,6 +751,17 @@ export class Tabs extends TabsBase {
|
||||
}
|
||||
}
|
||||
|
||||
private updateItem(tabStripItem: TabStripItem): void {
|
||||
const tabBarItem = this.createTabBarItem(tabStripItem, tabStripItem._index);
|
||||
const tabBarItemController = this._ios.viewControllers[tabStripItem._index];
|
||||
updateTitleAndIconPositions(tabStripItem, tabBarItem, tabBarItemController);
|
||||
|
||||
this.setViewTextAttributes(tabStripItem.label);
|
||||
|
||||
tabBarItemController.tabBarItem = tabBarItem;
|
||||
tabStripItem.setNativeView(tabBarItem);
|
||||
}
|
||||
|
||||
private createTabBarItem(item: TabStripItem, index: number): UITabBarItem {
|
||||
let image: UIImage;
|
||||
let title: string;
|
||||
@@ -966,6 +977,10 @@ export class Tabs extends TabsBase {
|
||||
this.setIconColor(tabStripItem, true);
|
||||
}
|
||||
|
||||
public setTabBarIconSource(tabStripItem: TabStripItem, value: UIColor | Color): void {
|
||||
this.updateItem(tabStripItem);
|
||||
}
|
||||
|
||||
public setTabBarItemFontInternal(tabStripItem: TabStripItem, value: Font): void {
|
||||
this.setViewTextAttributes(tabStripItem.label);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user