question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Platform.backButton.subscribeWithPriority doesn't manage priorities

See original GitHub issue

Bug 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:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

14reactions
Keteccommented, Jul 22, 2019

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.

0reactions
ionitron-bot[bot]commented, Jun 18, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found