Block Hardware back button JUST in rootPage

#1

I need help in locking Hardware back button in rootPage. Unfortunately when I override its behavior with platform.registerBackButtonAction() the button is locked in all the app.
This what I tried in my homepage:

priority:number;
 ngAfterViewInit() {
    this.platform.registerBackButtonAction(() => {
      if (!this.navCtrl.canGoBack()) this.priority = 1
      else this.priority = -2000
     
    }, this.priority);
  }
  ionViewDidLeave() {
    this.priority = -2000
  }
#2

Any ideas please ? help

#3

Take a look at his:

#4

Using registerBackButtonAction harm the UX. I have a delay of 650 ms whenever I press the hardware back button.