From b8222a88b413997b3a9d2e5b192080766d0ca296 Mon Sep 17 00:00:00 2001 From: vakrilov Date: Thu, 15 Oct 2015 16:04:19 +0300 Subject: [PATCH] Fixes --- ui/styling/stylers.android.ts | 10 ++++++---- ui/tab-view/tab-view-common.ts | 2 +- ui/tab-view/tab-view.d.ts | 2 +- ui/tab-view/tab-view.ios.ts | 10 +++++----- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/ui/styling/stylers.android.ts b/ui/styling/stylers.android.ts index a7243fcec..e23949a5c 100644 --- a/ui/styling/stylers.android.ts +++ b/ui/styling/stylers.android.ts @@ -662,11 +662,13 @@ export class TabViewStyler implements definition.stylers.Styler { } var tab = view; - var count = tab.items ? tab.items.length : 0; - var tabLayout = tab._getAndroidTabView(); - for (var i = 0; i < count; i++) { - tabLayout.getTextViewForItemAt(i).setTextColor(nativeValue); + if (tab.items && tab.items.length > 0) { + var tabLayout = tab._getAndroidTabView(); + + for (var i = 0; i < tab.items.length; i++) { + tabLayout.getTextViewForItemAt(i).setTextColor(nativeValue); + } } } diff --git a/ui/tab-view/tab-view-common.ts b/ui/tab-view/tab-view-common.ts index e7092aac0..eac3fcbd3 100644 --- a/ui/tab-view/tab-view-common.ts +++ b/ui/tab-view/tab-view-common.ts @@ -257,7 +257,7 @@ export class TabView extends view.View implements definition.TabView, view.AddAr return undefined; } - public _updateIOSTabBarColors() { + public _updateIOSTabBarColors(): void { // iOS sepcific } } \ No newline at end of file diff --git a/ui/tab-view/tab-view.d.ts b/ui/tab-view/tab-view.d.ts index 46be5c9b2..2e80b72f0 100644 --- a/ui/tab-view/tab-view.d.ts +++ b/ui/tab-view/tab-view.d.ts @@ -96,7 +96,7 @@ declare module "ui/tab-view" { //@private _getAndroidTabView(): org.nativescript.widgets.TabLayout; - _updateIOSTabBarColors(); + _updateIOSTabBarColors(): void; //@endprivate } } \ No newline at end of file diff --git a/ui/tab-view/tab-view.ios.ts b/ui/tab-view/tab-view.ios.ts index d73408764..81cf92dcc 100644 --- a/ui/tab-view/tab-view.ios.ts +++ b/ui/tab-view/tab-view.ios.ts @@ -78,7 +78,7 @@ class UINavigationControllerDelegateImpl extends NSObject implements UINavigatio export class TabViewItem extends common.TabViewItem { public _controller: UIViewController; public _parent: TabView; - + public _update() { if (this._parent && this._controller) { var icon = this._parent._getIcon(this.iconSource); @@ -198,7 +198,7 @@ export class TabView extends common.TabView { item._controller = newController; var icon = this._getIcon(item.iconSource); - + var tabBarItem = UITabBarItem.alloc().initWithTitleImageTag((item.title || ""), icon, i); if (!icon) { if (types.isFunction(tabBarItem.setTitlePositionAdjustment)) { @@ -308,7 +308,7 @@ export class TabView extends common.TabView { (heightMode === utils.layout.UNSPECIFIED) ? Number.POSITIVE_INFINITY : height)); } - public _updateIOSTabBarColors() { + public _updateIOSTabBarColors(): void { if (!this.items) { return; } @@ -325,12 +325,12 @@ export class TabView extends common.TabView { } function getTitleAttributesForStates(tabView: TabView): { normalState: any, selectedState: any } { - var normalState = {}; + var normalState = {}; if (tabView.color instanceof color.Color) { normalState[UITextAttributeTextColor] = tabView.color.ios; } - var selectedState = {}; + var selectedState = {}; if (tabView.selectedColor instanceof color.Color) { selectedState[UITextAttributeTextColor] = tabView.selectedColor.ios; }