-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"ASSERT: _before() should be called while animating" #13
Comments
Thanks for reporting it. |
It seems this issue is originated by the misuse of Ionic page life cycle events. If a page wants to hide the side menu, it should disable the menu on the The code should look something like this: constructor(public menu: MenuController) { }
ionViewDidEnter(): void {
this.menu.enable(false);
}
ionViewDidLeave(): void {
this.menu.enable(true);
} We will include this fix in the upcoming update. |
@agustinhaller Many thanks , i really appreciate your instant help ,the fix work like a charm. |
@agustinhaller : we are experiencing the same problem, but we are using ionViewDidEnter and ionViewDidLeave. Any ideas why this might be happening? |
Hi @dev-nossos , are you using the latest version of the template? That is 2.2.0 |
Hi! I was plagued by this issue recently, it was caused by my sign out button being on the slide menu. When I signed out, the animation for the menu closing was slower than the navigation, and as I landed back on the sign in screen, the menu was disabled. Logging back in right away would not re-enable the menu, and forcing it to be enabled caused the assertion error. My solution was moving my sign out logic as a callback function that executes when the Promise of TL;DR, wait for your |
Is this fixed? I disable the side menu on my app home page and enable it before navigating to other pages. I tried both ionViewWillLeave and ionViewDidLeave for enabling the menu but it does not fix. Tapping the toggle still throws the annoying assert error and menu disappears. If I tap the toggle again then it works without any issues. |
Hi @ebizbuddy, yes, this was fixed as proposed in #13 (comment) Why don't you enable it in |
Hi @djabif, the user requirement is to show the side menu on all app pages except the home page. Hence, we have to disable it as soon as the home page is loaded and enable it as soon as the home page is left. If we have to use ionViewDidEnter then it would be needed in each and every page except home page. It will be tedious and not a good implementation! If the fix works in ionViewDidEnter then why not in ionViewDidLeave? |
Hi @ebizbuddy I also had the same issue, tried the above solution but still the menu will throw the error the first time. In my case I solved it by adding the code in my login component as suggested:
and (most important) changed the navigation. I was using the following code to navigate to login (the page that shouldn't display the side menu): |
This is how I was able to fix this: when navigating away, going into the page where t his ASSERT issue happened), I used: |
Problema do menu lateral => ionicthemes/ionic6-starter-app#13
I'm still having this issue if I put an There is a
|
same, still having issue even after doing the below. ionViewDidEnter(): void {
I have also tried putting protection as below, the issue still remains. this.MenuController.close().then(() => { issue is found under debugger; // tslint:disable-line. |
Hey, I will check the issue to see if I can reproduce it and will try to find a fix for it. |
I notice one thing, say, when a user login (login page) successfully to home (home page). If I enable the menu controller when it leaves out of login page, on the Home page, the menu is shown and is already enabled. However, the moment I tried to click on the menu and the menu pops out, the application freezes. If I comment out the below ionViewDidLeave, there is no freeze. However, my menu won't pop out. I guess the problem appears because the Menucontroller is activated from the previous page and passed on into another page. But hey, if this is the only way for the menu to pop out on the home page, do I have a choice? Hope it helps. ionViewDidEnter(): void { ionViewDidLeave(): void { |
i solved it by @nvstdmn advice |
Had the same issue when trying to disable side menu when I left the home page, and re-enable it when I navigated back. Turns out if you try disable menu using ionViewDidLeave(), then issue arises due to the disabling happening during the close animation. Solved it by using a simple timeout: ionViewDidEnter() { ionViewDidLeave() { |
I got this error when i navigate from toggle menu back to Login screen and after i login again and open the toggle menu .
I tried to google about this issue and it seems there is an issue with ion-menu-toggle .
Please find my ionic info below :
`Ionic:
Ionic CLI : 5.4.16 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 5.0.0
@angular-devkit/build-angular : 0.803.25
@angular-devkit/schematics : 8.2.2
@angular/cli : 8.3.25
@ionic/angular-toolkit : 2.1.2
Capacitor:
Capacitor CLI : 1.5.0
@capacitor/core : 1.5.0
Utility:
cordova-res : not installed
native-run : not installed
System:
NodeJS : v12.14.1 (/usr/local/bin/node)
npm : 6.13.7
OS : macOS Catalina`
The text was updated successfully, but these errors were encountered: