ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

RC4 popover.onWillDismiss Not Firing From A Popover Inside Of A Popover

Open SudharsanSukumar opened this issue 9 years ago • 5 comments

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:

In RC4, when a popover inside of a popover is dismissed, the onWillDismiss callback never fires, OnDidDismiss does fire however.

Expected behavior:

onWillDismiss should fire

Steps to reproduce:

Clone the Ionic2 tutorial and create two popovers. Open one popover from a page and then open the second popover from within the first popover. Add function for onWillDismiss and notice that when the second popover is closed, onWillDismiss never fires but onDidDismiss does.

I've created a dummy project I can share if necessary. I tried the plunker but it appeared to be running rc2.

Related code:

import { Component } from '@angular/core';
import { ViewController, PopoverController } from 'ionic-angular';
import { Pop2 } from './popover2.component';

@Component({
    templateUrl: 'popover1.html'
})

export class Pop1 {

    constructor(
        public viewCtrl: ViewController,
        public popoverCtrl: PopoverController
    ) {

    }

    openSecondPop(event) {
        let popover = this.popoverCtrl.create(Pop2);
        popover.onWillDismiss((data) => {
            //This never fires!
            console.log('on will dismiss data received from second pop: ');
            console.log(data);
        });
        popover.onDidDismiss((data) => {
            //This does fire!
            console.log('on did dismiss data received from second pop: ');
            console.log(data);
        });
        popover.present({
            ev: event
        });
    }

    //Close popover and send option string as a NavParam
    close(option: string) {
        this.viewCtrl.dismiss({
            option: option
        });
    }
}

Other information:

This has worked since beta 11 I believe and then stopped working with the release of RC4. The first popover does fire onWillDismiss, just not the second popover that is created in the first popover.

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

Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.17
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.47
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.2.1
Xcode version: Not installed

SudharsanSukumar avatar Dec 20 '16 20:12 SudharsanSukumar

Just tested this with RC5 and it's still an issue. Reverted back to RC1 and it's working as intended.

SudharsanSukumar avatar Jan 12 '17 19:01 SudharsanSukumar

Same issue with 2.0 Final. onDidDismiss() somehow works...

sifang avatar Feb 01 '17 07:02 sifang

Seems to have been fixed somewhere between 3.0.0 and 3.6.0.

SudharsanSukumar avatar Sep 07 '17 22:09 SudharsanSukumar

I found this behavior on 3.9.2, onDidDismiss() still works.

ibrahimAboelsuod avatar Sep 27 '17 12:09 ibrahimAboelsuod

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.

ionitron-bot[bot] avatar Sep 02 '18 01:09 ionitron-bot[bot]