Ionic-framework: ionic 2 bug - if I hide nav bar and show nav bar my back button hide

Created on 4 Apr 2017  路  4Comments  路  Source: ionic-team/ionic-framework

Ionic version: (check one with "x")
[ ] 1.x
[ x] 2.x

I'm submitting a ... (check one with "x")
[x ] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

If I hide nav bar, then show nav bar, back button not showing.

Expected behavior:

If I hide nav bar, then show nav bar, the back button should appear (because, In begin it was in nav bar).

Steps to reproduce:

if I use:

<ion-navbar color='indigos' *ngIf="showBlock">
    <ion-title>Title</ion-title>
    <ion-buttons end>
      <button ion-button icon-only (click)="searchToggle()">
        <ion-icon name="search"></ion-icon>
      </button>
    </ion-buttons>
  </ion-navbar>

and hide block, then I show It, that the back button no longer appears (before I hid nav bar - back button was).

Inspector showed, that main.css contains the following code:

.back-button {
    display:none;
}

Method this.viewCtrl.showBackButton(true) also not working.

If use, exmaple, [ngClass] and create class:
.hide {display:none}, that is OK:

<ion-navbar color='indigos' [ngClass]="addClass">
    <ion-title>Title</ion-title>
    <ion-buttons end>
      <button ion-button icon-only (click)="searchToggle()">
        <ion-icon name="search"></ion-icon>
      </button>
    </ion-buttons>
  </ion-navbar>

addClass - is variable:

public addClass:string = "";
 searchToggle() {
    this.addClass = "hide";
  }

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Cordova CLI: 6.5.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.1.7
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 8.1
Node Version: v6.9.5

All 4 comments

Hello, thanks for using Ionic! You can check out this comment for an example of how to use the resize method in situations where you have functionality like you describe.

@jgw96, No! It other error (and resize() not decides this problem)! Header size is fixed (I hide nav bar and I show search bar), but when I show nav bar and hide search bar again, back button not show...

Same problem here!

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Was this page helpful?
0 / 5 - 0 ratings