You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The IonMenuButton gets hidden after having switched to another IonPage and back. Even when we set autoHide={false} the button however is prevented from being hidden but you'll see that it's detached from the menu since the menu doesn't get opened again when tapping.
Expected behavior:
Having an IonMenuButton which works despite of switching IonPages
Steps to reproduce:
tap on the menu button on the initial IonPage. This will open the side menu as expected
switch to another IonPage (press on 'second' in the sample)
turn back to the initial page (this will happen automatically in the sample)
tap on the menu button again. But there is no visible IonMenuButton anymore. Even if it was, this wouldn't work either.
Related code:
//App.tsximport{Redirect,Route}from'react-router-dom';import{IonApp,IonRouterOutlet}from'@ionic/react';import{IonReactRouter}from'@ionic/react-router';importHomefrom'./pages/Home';/* Core CSS required for Ionic components to work properly */import'@ionic/react/css/core.css';/* Basic CSS for apps built with Ionic */import'@ionic/react/css/normalize.css';import'@ionic/react/css/structure.css';import'@ionic/react/css/typography.css';/* Optional CSS utils that can be commented out */import'@ionic/react/css/padding.css';import'@ionic/react/css/float-elements.css';import'@ionic/react/css/text-alignment.css';import'@ionic/react/css/text-transformation.css';import'@ionic/react/css/flex-utils.css';import'@ionic/react/css/display.css';/* Theme variables */import'./theme/variables.css';importSecondfrom'./pages/Second';constApp: React.FC=()=>(<IonApp><IonReactRouter><IonRouterOutlet><Routeexactpath="/home"><Home/></Route><Routeexactpath="/second"><Second/></Route><Routeexactpath="/"><Redirectto="/home"/></Route></IonRouterOutlet></IonReactRouter></IonApp>);exportdefaultApp;//Home.tsximportReact,{}from'react';import{IonContent,IonHeader,IonItem,IonLabel,IonMenu,IonMenuButton,IonPage,IonTitle,IonToolbar}from'@ionic/react';import{useHistory}from'react-router';exportconstMyMenu=()=>{return(<IonMenumenuId="my-menu"contentId="home-content"side="end"type="overlay"><IonContentid="menu-content"><IonLabel>MENU1</IonLabel></IonContent></IonMenu>)}constHome: React.FC=()=>{consthistory=useHistory()return(<IonPage><MyMenu/><IonHeader><IonToolbar><IonTitle>Buggy</IonTitle><IonMenuButtonmenu="my-menu"slot="end"/></IonToolbar></IonHeader><IonContentfullscreenid="home-content"><IonItemonClick={()=>history.push('/second')}button>second</IonItem></IonContent></IonPage>);};exportdefaultHome;//Second.tsximportReactfrom'react';import{IonContent,IonHeader,IonLabel,IonMenu,IonMenuButton,IonPage,IonTitle,IonToolbar,useIonLoading,useIonViewDidEnter}from'@ionic/react';import{useHistory}from'react-router';constMyMenu2=()=>{return(<IonMenumenuId="my-menu2"contentId="second-content"side="end"type="overlay"><IonContentid="menu-content"><IonLabel>MENU2</IonLabel></IonContent></IonMenu>)}constSecond: React.FC=()=>{consthistory=useHistory()const[loading]=useIonLoading()useIonViewDidEnter(()=>{loading("going back",1000,'dots')setTimeout(history.goBack,1000)})return(<IonPage><MyMenu2/><IonHeader><IonToolbar><IonTitle>Second</IonTitle><IonMenuButtonmenu="my-menu2"slot="end"/></IonToolbar></IonHeader><IonContentfullscreenid="second-content">loremipsumdoloris</IonContent></IonPage>);};exportdefaultSecond;
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.
Bug Report
Ionic version:
[ ] 4.x
[x] 5.x
Current behavior:
The
IonMenuButton
gets hidden after having switched to anotherIonPage
and back. Even when we set autoHide={false} the button however is prevented from being hidden but you'll see that it's detached from the menu since the menu doesn't get opened again when tapping.Expected behavior:
Having an
IonMenuButton
which works despite of switchingIonPage
sSteps to reproduce:
IonPage
. This will open the side menu as expectedIonPage
(press on 'second' in the sample)IonMenuButton
anymore. Even if it was, this wouldn't work either.Related code:
Other information:
Ionic info:
The text was updated successfully, but these errors were encountered: