Platform.backButton.subscribeWithPriority doesn't manage priorities
See original GitHub issueBug Report
Ionic version: [x] 4.x
Current behavior:
The method subscribeWithPriority
doesn’t manage priority properly: it doesn’t matter which priority I’ve set, it doesn’t go back throught the stack. If I set a low priority it hides popups but still doesn’t change page.
It seems a bug but there’s any documentation for that method, so I don’t know if I’m using it wrong or it’s deprecated without any warning.
Expected behavior: Like in previous Ionic versions I was expecting to leave back working properly for pages using correct priority level.
Steps to reproduce:
Create a blank app with Android platform, add a second page, and manage .backButton.subscribeWithPriority()
inside app.component.ts
Related code:
initializeApp() {
this.platform.ready().then(() => {
this.statusBar.styleDefault();
this.splashScreen.hide();
this.platform.backButton.subscribeWithPriority(601, async () => {
console.log('Back Pressed');
})
});
}
Ionic info:
Ionic:
ionic (Ionic CLI) : 4.12.0
Ionic Framework : @ionic/angular 4.1.1
@angular-devkit/build-angular : 0.12.4
@angular-devkit/schematics : 7.2.3
@angular/cli : 7.2.4
@ionic/angular-toolkit : 1.3.0
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 8.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 13 other plugins)
System:
Android SDK Tools : 26.1.1 (/opt/android-sdk)
NodeJS : v10.15.3 (/home/vittorio/.nvm/versions/node/v10.15.3/bin/node)
npm : 6.4.1
OS : Linux 4.18
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
the Hardware Back Button does not work with Ionic and Angular
I put this line in " this.platform.ready().then(async () => {". – le cyclone. Oct 25 at 13:42. That's because the priority is set...
Read more >Hardware Back Button for Capacitor & Cordova on Android ...
Internally, Ionic Framework uses something similar to a priority queue to manage hardware back button handlers. The handler with the largest priority value...
Read more >TypeScript (backbutton) - "this.unsubscribeBackEvent is not a ...
Trying to have a popup or alert upon clicking the back button so that the user does not prevent unsaved changes on the...
Read more >Customizing Android Back Button in Ionic 4 | Damir's Corner
platform.backButton.subscribeWithPriority(10000, () => this.onBack() );. Without documentation, one can only guess what value ...
Read more >hardware back button event and confirm by the user to exit ...
How to handle hardware back button event and confirm by the user to exit ... The Ionic framework application for PWA and browsers...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Being able to control your navigation stacks and clicks etc should be the absolute basics. Yet this is open for 4 months.
It shouldn’t have been out of beta or RC stage yet with this kind of bugs.
But now I’m stuck with it, people above are waiting for an explanation for delays and best I can tell them is “ionic has major bugs but they haven’t fixed them”. And release is delayed again - which means financial impact.
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.