Hardware back button click event not clear the history of the previously opened pages

Hello Everyone,
I’m new in the Ionic framework recently I’m working on example where i have Login page, forgot password page and registration page.
whenever I perform hardware back click event to go to previous page then it does go to previous page using
below method

@HostListener(‘document:ionBackButton’, [’$event’])
private overrideHardwareBackAction($event: any) {
$event.detail.register(100, async () => {
// Do what you want

   //  this.router.navigate(['login-screen']);
       this.navCtrl.navigateRoot('login-screen');
     
});

}

When I click on forgot password page and click on back button it goes to login screen but on twice back button click it automatically opens the registration page and when I click back button on registration page it goes to login screen but on twice back button click on registration page it automatically opens the forgot password page which I think messed up with the back stack history uses in android.
None of the above method clears the stack history.

Please need help…