henrychavez / nativescript-bottom-navigation

Nativescript plugin for Android & iOS to have the bottom navigation bar of Material Design
Apache License 2.0
58 stars 18 forks source link

BottomNavigationBar not working with version 2.0.5 and my nativescript version is 6.0 #81

Open prabh08 opened 5 years ago

prabh08 commented 5 years ago

home.xml

 <Page xmlns="http://schemas.nativescript.org/tns.xsd"
  xmlns:mdc="nativescript-bottom-navigation"
  loaded="onNavigatedToMainTab"
  class="page">
   <GridLayout rows="*, auto">
     <StackLayout row="0">
        <Label text="content"></Label>
     </StackLayout>
    <mdc:BottomNavigation
      tabs="{{ tabs }}"
      activeColor="green"
      inactiveColor="red"
      backgroundColor="black"
      tabSelected="tabSelected"
      row="1"
    ></mdc:BottomNavigation>
  </GridLayout>
 </Page>

home.js

var Observable = require("data/observable").Observable;
var BottomNavigationTab = require('nativescript-bottom-navigation').BottomNavigationTab;
var TabSelectedEventData = require('nativescript-bottom-navigation').TabSelectedEventData;

function onNavigatedToMainTab(args) {
    let page = args.object;
    page.bindingContext = {
    tabs: [
        new BottomNavigationTab({ title: 'First' }),
        new BottomNavigationTab({ title: 'Second' }),
        new BottomNavigationTab({ title: 'Third' }),
    ],
   };
 }

 function tabSelected() {
     console.log('tab selected ' + TabSelectedEventData.newIndex);
 }
 exports.onNavigatedToMainTab = onNavigatedToMainTab;

 exports.tabSelected = tabSelected;`

I am getting this error on Android build with webpack.

Attempt to invoke virtual method 'int android.view.View.getVisibility()' on a null object reference

Please help me on this.

henrychavez commented 5 years ago

Hi you should use BottomNavigationBar not BottomNavigation

prabh08 commented 5 years ago

@henrychavez I also tried with BottomNavigationBar but its not working dear. Is there any another plugin with similar functionality.