![npm](https://img.shields.io/npm/dt/nativescript-bottombar.svg?label=npm%20downloads)
NativeScript BottomBar :beers::fire::fr:
NativeScript plugin for AHBottomNavigation and MiniTabBar.
Checkout demo.
Installation
Usage
API documentation
Angular NativeScript
XML
<GridLayout rows="*, auto">
<StackLayout row="0" orientation="vertical">
<Label text="demo"></Label>
</StackLayout>
<BottomBar row="1" [items]="items" [hide]="hidden" [titleState]="titleState" (loaded)="tabLoaded($event)" (tabSelected)="tabSelected($event)" [inactiveColor]="inactiveColor" [accentColor]="accentColor" colored="true"></BottomBar>
</GridLayout>
Component
import { Component } from "@angular/core";
import { registerElement } from 'nativescript-angular';
import { BottomBar, BottomBarItem, TITLE_STATE, SelectedIndexChangedEventData, Notification } from 'nativescript-bottombar';
registerElement('BottomBar', () => BottomBar);
@Component({
selector: "nsapp",
templateUrl: "app.component.html",
})
export class AppComponent {
public hidden: boolean;
public titleState: TITLE_STATE;
public _bar: BottomBar;
public inactiveColor: string;
public accentColor: string;
public items: Array<BottomBarItem> = [
new BottomBarItem(0, "Home", "ic_home_black_24dp", "black", new Notification("blue", "white", "1")),
new BottomBarItem(1, "Calendar", "ic_calendar", "#1083BF", new Notification("green", "blue", "1")),
new BottomBarItem(2, "Profile", "ic_collaborator", "pink", new Notification("pink", "yellow", "1")),
new BottomBarItem(3, "Message", "ic_paperplane", "green", new Notification("green", "red", "1"))
];
tabLoaded(event) {
this._bar = <BottomBar>event.object;
this.hidden = false;
this.titleState = TITLE_STATE.SHOW_WHEN_ACTIVE;
this.inactiveColor = "white";
this.accentColor = "blue";
}
tabSelected(args: SelectedIndexChangedEventData) {
console.log(args.newIndex);
}
}
Ressources
Don't forget that you need your icons files to be in your ressources folder as follow:
iOS | Android |
---|
![iOS](https://github.com/rhanbIT/nativescript-bottombar/raw/HEAD/screenshots/ressources.ios.png) | ![Android](https://github.com/rhanbIT/nativescript-bottombar/raw/HEAD/screenshots/ressources.android.png) |
API documentation