Hide Ionic tabs and Toolbar on botton click [Ionic 4.0.0]


#1

Hi, I was wondering if its possible to hide the Ion-tabs and Ion-toolbar on a button click.

   async toggleFullScreen() {
    const loading = await this.loadingCtrl.create({
      message: "",
      spinner: "lines",
      duration: 2000
    });
    await loading.present();
    const style = document.getElementById("full").style;
    await this.platform.ready();
    const [ data, color] = this.fullscreen === "all" ?
      ["true", "on", "#f2af46"] :
      ["false", "off", "transparent"];
       //TODO write code that hides toolbar and tabs
       //
       //
       //
      loading.dismiss();
     
    localStorage.setItem("Fullbutton", this.fullscreen = data);
    style.backgroundColor = color;
  }

I’d like to run a function like this on a button click, I’ve seen a few posts but they all seem to be about hiding the toolbar/tabs on ngViewDidEnter (Example)
I’d like to keep the tabs and toolbar until the button was clicked.

Any help or resources that could help with my issue would be greatly appreciated!


#2

If someone has a similar issue this is how i did it

 async toggleFullScreen() {
    const loading = await this.loadingCtrl.create({
      message: '',    
      spinner: 'lines',
      duration: 2000
    });
    await loading.present();
        
    var style = document.getElementById('full').style;
      if(this.status === 'show') {
        this.status = 'hide'
        localStorage.setItem("hide", this.status);
        style.backgroundColor = "#f2af46";
        document.getElementById("tabs").style.display = "none";
        document.querySelector("ion-tab-bar")['style'].display = 'none';
        loading.dismiss();
        } else {
          this.status = 'show'
          document.querySelector("ion-tab-bar")['style'].display = 'flex';
          document.getElementById("tabs").style.display = "block";
          localStorage.setItem("show", this.status);
          style.backgroundColor = "#fff";
          loading.dismiss();
          }
  }

Its probably not the cleanest way of doing things, but it works.