Ionic-framework: onWillDismiss() not called in stacked Modal Controllers

Created on 2 Feb 2017  路  7Comments  路  Source: ionic-team/ionic-framework

Ionic version: (check one with "x")
[ ] 1.x
[x] 2.x

I'm submitting a ... (check one with "x")
[x ] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

onWillDismiss() not called in Modal Controller created by another Modal

Expected behavior:

onWillDismiss() gets called

Steps to reproduce:
[Sorry I don't know how to use Plunker yet]
Page A: create instance of Page B via Modal Controller
Page B: create instance of Page C via Modal Controller:

let modal = this.modalCtrl.create(CPage);
    modal.present();
    modal.onWillDismiss((data: any) => {
      console.log("CPage dismissed");
      if (data) {
        // returning data from Modal Controller
        ...  
      }
    });

the onWillDismiss() never gets called, after C is dismissed.

Related code:
Please see section above

Other information:

  1. onDidDismiss() somehow works in this situation.
  2. non-stacked Modal, everything is fine. E.g. Nav Controller calls Modal
  3. this issue may be related to another issue, but with PopOver instead: https://github.com/driftyco/ionic/issues/9735

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 1.0.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: macOS Sierra
Node Version: v6.9.1
Xcode version: Xcode 8.1 Build version 8B62

stale issue

Most helpful comment

onDidDismiss() did works, but not onWillDismiss(). Is there any soltuion?

All 7 comments

Just ran into this. I believe the bug is here. Because there is an enteringView (the modal underneath the one that's being dismissed), it acts like the dismissed modal isn't unloading when it actually is. This bypasses the onWillDismiss callback here.

I have the same problem.

same here!

any updates on this please ? I have the same problem

onDidDismiss() did works, but not onWillDismiss(). Is there any soltuion?

Also have the same issue. Any fixes here?

Thanks for the issue! This issue is being closed due to inactivity. 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.

Thank you for using Ionic!

Was this page helpful?
0 / 5 - 0 ratings