Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RC0] Regression: Presenting Alert or ActionSheet destroys Modal #8573

Closed
alex-pl opened this issue Oct 8, 2016 · 6 comments
Closed

[RC0] Regression: Presenting Alert or ActionSheet destroys Modal #8573

alex-pl opened this issue Oct 8, 2016 · 6 comments
Assignees

Comments

@alex-pl
Copy link
Contributor

alex-pl commented Oct 8, 2016

Creating and presenting an Alert or ActionSheet inside of a Modal destroys the modal. The modals callback isn't called and the hide animation isn't played either. The alert or action sheet is not displayed.

Version: Ionic 2 rc0

Test Case

Modal

modal.ts

import { Component } from '@angular/core';
import { AlertController } from 'ionic-angular';

@Component({
    templateUrl: 'modal.html'
})
export class Modal {

    constructor(private alertController: AlertController) { }

    public ionViewDidEnter() {
        let alert = this.alertController.create({
            title: 'Test',
            buttons: [
                {
                    text: 'Something',
                    role: 'cancel'
                }
            ]
        });
        alert.present();
    }

}

modal.html

<ion-content>Hello :)</ion-content>

Page

page.ts

import { Component } from '@angular/core';
import { ModalController } from 'ionic-angular';
import { Modal } from '../modal';

@Component({
    templateUrl: 'page.html'
})
export class Page {

    constructor(private modalController: ModalController) { }

    open() {
        let modal = this.modalController.create(Modal);

        modal.onDidDismiss(() => {
            console.log('callback');
        });

        modal.present();
    }

}

page.html

<ion-header>
    <ion-navbar>
        <ion-title>Test</ion-title>
    </ion-navbar>
</ion-header>

<ion-content>
    <button ion-button (click)="open()">Show Modal</button>
</ion-content>
@manucorporat manucorporat self-assigned this Oct 8, 2016
@jgw96 jgw96 added the v2 label Oct 10, 2016
manucorporat added a commit that referenced this issue Oct 10, 2016
@manucorporat
Copy link
Contributor

@alex-pl I can not reproduce this bug with the provided source code.
can you create a repo that reproduces the issue?

@alex-pl
Copy link
Contributor Author

alex-pl commented Oct 12, 2016

Sorry for the delay, I've created a repository now:
https://github.com/alex-pl/ionic-modal-alert-issue

The test case is based on the tutorial template:

ionic start ionic-modal-alert-issue tutorial --v2

I've committed every step and added a short readme to make it as clear as possible.
Thanks for looking into it!

@manucorporat
Copy link
Contributor

ok, this was already fixed in RC1!

@alex-pl
Copy link
Contributor Author

alex-pl commented Oct 13, 2016

Awesome, thanks! 👍

@erperejildo
Copy link

erperejildo commented Apr 30, 2018

guys I'm using Ionic 3 and I still having this issue. Do I need to change any configuration?

options() {
    const actionSheet = this.actionSheetCtrl.create({
      title: 'Recipe',
      buttons: [
        {
          text: 'Edit',
          handler: () => {
          }
        },
        {
          text: 'Delete',
          role: 'destructive',
          handler: () => {
            const alert = this.alertCtrl.create({
              title: "Are you sure?",
              message: "You will clean your shopping list",
              buttons: [
                {
                  text: "Yes",
                  handler: () => {
                    console.log('yes')
                  }
                },
                {
                  text: "No",
                  role: "cancel",
                  handler: () => {
                    console.log('no');
                  }
                }
              ]
            });
            alert.present();
          }
        },
        {
          text: 'Cancel',
          role: 'cancel',
          handler: () => {
            console.log('Cancel clicked');
          }
        }
      ]
    });
    actionSheet.present();
  }

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 1, 2018

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 ionitron-bot bot locked and limited conversation to collaborators Sep 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants