Skip to content

Commit b4d81bd

Browse files
committed
fix error: Not default tab selected
1 parent f1bfcfe commit b4d81bd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/bottomnavigationbar/bottomnavigationbar.ios.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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 { BottomNavigationBarBase, BottomNavigationTabBase, TitleVisibility, activeColorCssProperty, badgeColorCssProperty, badgeTextColorCssProperty, inactiveColorCssProperty, tabsProperty, titleVisibilityProperty } from './bottomnavigationbar-common';
44

55
@NativeClass
66
class BottomNavigationBarDelegate extends NSObject {
@@ -140,10 +140,11 @@ export class BottomNavigationBar extends BottomNavigationBarBase {
140140
return tab;
141141
});
142142
this.nativeViewProtected.items = new NSArray({ array: bottomNavigationTabs });
143+
let tabsArray = Utils.ios.collections.nsArrayToJSArray(this.nativeViewProtected.items)
143144

144145
// TODO: this is for he v8 runtime. Should not have to need this setTimeout(), find better way.
145146
setTimeout(() => {
146-
this.nativeViewProtected.selectedItem = this.nativeViewProtected.items[this.selectedTabIndex];
147+
this.nativeViewProtected.selectedItem = tabsArray[this.selectedTabIndex];
147148
}, 0);
148149
}
149150

@@ -174,7 +175,7 @@ declare class MDCBottomNavigationItemView extends UIView {
174175
export class BottomNavigationTab extends BottomNavigationTabBase {
175176
nativeViewProtected: UITabBarItem;
176177
createNativeView() {
177-
let icon = this.getNativeIcon() ;
178+
let icon = this.getNativeIcon();
178179
if (icon) {
179180
icon = icon.imageWithRenderingMode(UIImageRenderingMode.Automatic);
180181
}

0 commit comments

Comments
 (0)