fix(ios-tabs): item appearance toggle b/n titles and images (#7502)

This commit is contained in:
Manol Donev
2019-07-11 00:35:38 +03:00
committed by GitHub
parent d8262a624e
commit c0c79f31cf

View File

@ -84,10 +84,6 @@ class UIPageViewControllerImpl extends UIPageViewController {
} }
tabBar.delegate = this.tabBarDelegate = MDCTabBarDelegateImpl.initWithOwner(new WeakRef(owner)); tabBar.delegate = this.tabBarDelegate = MDCTabBarDelegateImpl.initWithOwner(new WeakRef(owner));
// Initially set `itemAppearance` to TitledImages.
// Reassign if needed when items available.
// Other combinations do not work.
tabBar.itemAppearance = MDCTabBarItemAppearance.TitledImages;
tabBar.tintColor = UIColor.blueColor; tabBar.tintColor = UIColor.blueColor;
tabBar.barTintColor = UIColor.whiteColor; tabBar.barTintColor = UIColor.whiteColor;
tabBar.setTitleColorForState(UIColor.blackColor, MDCTabBarItemState.Normal); tabBar.setTitleColorForState(UIColor.blackColor, MDCTabBarItemState.Normal);
@ -854,6 +850,8 @@ export class Tabs extends TabsBase {
if (this.viewController && this.viewController.tabBar) { if (this.viewController && this.viewController.tabBar) {
this.viewController.tabBar.itemAppearance = this._getTabBarItemAppearance(); this.viewController.tabBar.itemAppearance = this._getTabBarItemAppearance();
this.viewController.tabBar.items = NSArray.arrayWithArray(tabBarItems); this.viewController.tabBar.items = NSArray.arrayWithArray(tabBarItems);
// TODO: investigate why this call is necessary to actually toggle item appearance
this.viewController.tabBar.sizeToFit();
this.tabStrip.setNativeView(this.viewController.tabBar); this.tabStrip.setNativeView(this.viewController.tabBar);
} }