nativescript-bottombar icon indicating copy to clipboard operation
nativescript-bottombar copied to clipboard

BottomBar LABEL_VISIBILITY.SELECTED not working

Open MGalatioto opened this issue 7 years ago • 7 comments

  • If the demo apps cannot help and there is no issue for your problem, tell us about it Hi! As mentioned in the tile, if I select in the bottom bar a BottomBarItem, the route works, BUT, the home (in my app, the dashboard) gets always selected. Here is my code:

`import { Component, OnInit } from "@angular/core"; import { RadSideDrawer } from "nativescript-ui-sidedrawer"; import * as app from "tns-core-modules/application"; import { BottomBar, LABEL_VISIBILITY, TabSelectedEventData } from "nativescript-bottombar"; import { Router } from "@angular/router";

@Component({ moduleId: module.id, selector: "aktuelle-module", templateUrl: "./aktuelle-module.component.html" }) export class AktuelleModuleComponent implements OnInit { globalVariables: any = global; private bottomBar: BottomBar; labelVisibility: LABEL_VISIBILITY; actualModules: any[];

constructor(private router: Router) {
    this.labelVisibility = LABEL_VISIBILITY.SELECTED;
    this.actualModules = this.globalVariables.actualModules;
}

ngOnInit() {}

onDrawerButtonTap() {
    const sideDrawer = <RadSideDrawer>app.getRootView();
    sideDrawer.showDrawer();
}

async tabSelected(event: TabSelectedEventData) {
    const tabbedIcon = event.newIndex;
    if (tabbedIcon === 0) {
        await this.router.navigate(["/dashboard"]);
    }
    if (tabbedIcon === 1) {
        await this.router.navigate(["/aktuelle-module"]);
    }
    if (tabbedIcon === 2) {
        await this.router.navigate(["/credits"]);
    }
    if (tabbedIcon === 3) {
        await this.router.navigate(["/info"]);
    }
}

barLoaded(event) {
    this.bottomBar = event.object;
}

} `

So when i click to 'aktuelle-module' the routing works, but the dashboard gets selected. Also, here the template of 'aktuelle-module'

`<FlexboxLayout class="page">

<ScrollView height="90%">
  <StackLayout class="form">
    <StackLayout *ngFor="let currentModule of actualModules; index as i">
      <GirdLayout rows="auto, auto" columns="auto" class="gridActualModules">
          <GridLayout *ngIf="currentModule['Code'] !== ''" row="0" rows="auto" columns="4*, 6*">
            <Label fontWeight="bold" textWrap="true" row="0" col="0" text="Code"></Label>
            <Label row="0" col="1" [text]="currentModule['Code']"></Label>
          </GridLayout>
          <GridLayout *ngIf="currentModule['Course'] !== ''" row="1" rows="auto" columns="4*, 6*">
            <Label fontWeight="bold" textWrap="true" row="0" col="0" text="Modulname"></Label>
            <Label textWrap="true" row="0" col="1" [text]="currentModule['Course']"></Label>
          </GridLayout>
        </GirdLayout>
      <StackLayout class="hr-light"></StackLayout>
    </StackLayout>
  </StackLayout>
</ScrollView>

<BottomBar (tabSelected)="tabSelected($event)" [androidLabelVisibility]="labelVisibility" (loaded)="barLoaded($event)">
  <BottomBarItem icon="res://home" title="Dashboard" checkedIcon="res://home"></BottomBarItem>
  <BottomBarItem icon="res://document" title="Aktuelle Module" checkedIcon="res://document"></BottomBarItem>
  <BottomBarItem icon="res://credits" title="Credits" checkedIcon="res://credits"></BottomBarItem>
  <BottomBarItem icon="res://info" title="Info" checkedIcon="res://info"></BottomBarItem>
</BottomBar>

</FlexboxLayout>`

  • Which platform(s) does your issue occur on? Android emulator AND device. NEXUS ONE API 27

I'd Appreciate any help! If there are more infos necessary, please tell me!

MGalatioto avatar Apr 26 '19 14:04 MGalatioto

Hi @MGalatioto ,

Thanks for reporting this issue, could you provide a simple repo to reproduce the issue? it would be a great help for me to reproduce the issue and fix it 👍

Thanks

rhanb avatar Apr 30 '19 12:04 rhanb

Hi @rhanb

appreciate your answer! I have only a private repo, since this is a project for an employer - Would be a playground helpful for you as well (if thats even possible in a playground..)?

Thank you already in advance for your answer!

BR, Marco

MGalatioto avatar May 01 '19 08:05 MGalatioto

Hi @rhanb Here is a zip where the error occurs - i'd appreciate your help really much. Best regards - marco NSAPP-master.zip

MGalatioto avatar May 05 '19 09:05 MGalatioto

Hi again, @rhanb

I honestly did not find the "bug", I searched for it but unfortunately I could not find any :-(

Did you get time to get an eye on it? (zip file above in the comment)

Really would appreciate it!

Thanks in advance.

BR, Marco

MGalatioto avatar May 09 '19 05:05 MGalatioto

Hi @rhanb Could you take a look at this? (I attached the code in the .zip file above). Thank you.

MGalatioto avatar May 29 '19 07:05 MGalatioto

Hi @MGalatioto , sorry for taking so long to answer, Understand that it's hard for me to find time to work on this repo with my current work.

The best would be to have a github repo (can be private, it's free).

Otherwise from what I see from your html template I don't see any router-outlet nor page-router-outlet

routing can't work without one of those

rhanb avatar May 29 '19 08:05 rhanb

Hi @rhanb

Yes, I completley understand.

Thank you for checking it.

I do have a page-router-outlet in my app.component.html ...

MGalatioto avatar Jun 06 '19 06:06 MGalatioto