简体   繁体   中英

How to hide Tabs in on Mobile Web client with Ionic PWA app

Tabs are perfect to have inside of iOS and Android apps, however having tabs on mobile web clients are not ideal because of the phone's bottom navigation bar. An example is how Etsy and Amazon scrap the tabs in their mobile web clients.

How can tabs be hidden on an Ionic React application for the mobile web client?

I imagine this will involve wrapping some sort of function or hook around the tabs with the below code.

 <IonTabBar slot="bottom">
          <IonTabButton tab="tab1" href="/tab1">
            <IonIcon icon={home} />
            <IonLabel></IonLabel>
          </IonTabButton>
          <IonTabButton tab="tab2" href="/tab2">
            <IonIcon icon={cart} />
            <IonLabel></IonLabel>
          </IonTabButton>
          <IonTabButton tab="tab3" href="/tab3">
            <IonIcon icon={person} />
            <IonLabel></IonLabel>
          </IonTabButton>
          <IonTabButton tab="tab4" href="/tab4">
            <IonIcon icon={menuSharp} />
            <IonLabel></IonLabel>
          </IonTabButton>
        </IonTabBar>

Thank you for any unique insights or perspectives.

Set a global variable tied to isPlatform('mobileweb');

And then hide the tab panel based on this value.

https://ionicframework.com/docs/react/platform

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM