Skip to content

Commit 9bfc80b

Browse files
committed
Merge branch 'master' of github.com:nativescript-community/ui-material-components
# Conflicts: # src/button/button.android.ts
2 parents d6d8296 + feb4247 commit 9bfc80b

File tree

4 files changed

+23
-16
lines changed

4 files changed

+23
-16
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@
9494
"dependencies": {
9595
"ts-node": "^8.10.2"
9696
}
97-
}
97+
}

src/bottomnavigationbar/bottomnavigationbar.ios.ts

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
import { themer } from '@nativescript-community/ui-material-core';
22
import { Application, Color, Screen, Utils, backgroundColorProperty } from '@nativescript/core';
3-
import { BottomNavigationBarBase, BottomNavigationTabBase,TitleVisibility, activeColorCssProperty, badgeColorCssProperty, badgeTextColorCssProperty, inactiveColorCssProperty, tabsProperty, titleVisibilityProperty } from './bottomnavigationbar-common';
3+
import {
4+
BottomNavigationBarBase,
5+
BottomNavigationTabBase,
6+
TitleVisibility,
7+
activeColorCssProperty,
8+
badgeColorCssProperty,
9+
badgeTextColorCssProperty,
10+
inactiveColorCssProperty,
11+
tabsProperty,
12+
titleVisibilityProperty
13+
} from './bottomnavigationbar-common';
414

515
@NativeClass
616
class BottomNavigationBarDelegate extends NSObject {
@@ -17,21 +27,23 @@ class BottomNavigationBarDelegate extends NSObject {
1727
if (!owner) {
1828
return;
1929
}
20-
if (owner.selectedTabIndex === item.tag) {
21-
owner._emitTabReselected(item.tag);
30+
const tag = item && item.tag ? item.tag : 0;
31+
if (owner.selectedTabIndex === tag) {
32+
owner._emitTabReselected(tag);
2233
return;
2334
}
24-
owner._emitTabSelected(item.tag);
35+
owner._emitTabSelected(tag);
2536
}
2637

2738
bottomNavigationBarShouldSelectItem(bottomNavigationBar: MDCBottomNavigationBar, item: UITabBarItem): boolean {
2839
const owner = this._owner.get();
2940
if (!owner) {
3041
return true;
3142
}
32-
const bottomNavigationTab = owner.items[item.tag];
43+
const tag = item && item.tag ? item.tag : 0;
44+
const bottomNavigationTab = owner.items[tag];
3345
if (!bottomNavigationTab.isSelectable) {
34-
owner._emitTabPressed(item.tag);
46+
owner._emitTabPressed(tag);
3547
}
3648
return bottomNavigationTab.isSelectable;
3749
}
@@ -140,10 +152,9 @@ export class BottomNavigationBar extends BottomNavigationBarBase {
140152
return tab;
141153
});
142154
this.nativeViewProtected.items = new NSArray({ array: bottomNavigationTabs });
143-
144155
// TODO: this is for he v8 runtime. Should not have to need this setTimeout(), find better way.
145156
setTimeout(() => {
146-
this.nativeViewProtected.selectedItem = this.nativeViewProtected.items[this.selectedTabIndex];
157+
this.nativeViewProtected.selectedItem = this.nativeViewProtected.items.objectAtIndex(this.selectedTabIndex);
147158
}, 0);
148159
}
149160

@@ -174,7 +185,7 @@ declare class MDCBottomNavigationItemView extends UIView {
174185
export class BottomNavigationTab extends BottomNavigationTabBase {
175186
nativeViewProtected: UITabBarItem;
176187
createNativeView() {
177-
let icon = this.getNativeIcon() ;
188+
let icon = this.getNativeIcon();
178189
if (icon) {
179190
icon = icon.imageWithRenderingMode(UIImageRenderingMode.Automatic);
180191
}

src/button/button.android.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,14 @@ import {
77
Font,
88
ImageSource,
99
Length,
10-
TextTransform,
1110
Utils,
1211
androidDynamicElevationOffsetProperty,
1312
androidElevationProperty,
1413
backgroundInternalProperty,
1514
colorProperty,
1615
profile,
17-
textAlignmentProperty,
18-
textTransformProperty
1916
} from '@nativescript/core';
20-
import { TextAlignment } from '@nativescript/core/ui/text-base';
17+
import { TextTransform, textAlignmentProperty , textTransformProperty } from '@nativescript/core/ui/text-base';
2118
import { ButtonBase, imageSourceProperty, srcProperty } from './button-common';
2219

2320
let LayoutInflater: typeof android.view.LayoutInflater;

src/button/button.ios.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
Font,
66
ImageSource,
77
Screen,
8-
TextTransform,
98
Utils,
109
backgroundInternalProperty,
1110
borderBottomLeftRadiusProperty,
@@ -14,8 +13,8 @@ import {
1413
borderTopRightRadiusProperty,
1514
colorProperty,
1615
fontInternalProperty,
17-
textTransformProperty
1816
} from '@nativescript/core';
17+
import { TextTransform, textTransformProperty } from '@nativescript/core/ui/text-base';
1918
import { ButtonBase, imageSourceProperty, srcProperty } from './button-common';
2019

2120
let buttonScheme: MDCContainerScheme;

0 commit comments

Comments
 (0)