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

presenting ActionSheet when a toast is displayed crash the app

Open Geoffrey-D opened this issue 10 years ago • 1 comments

Short description of the problem:

Presenting ActionSheet when a toast is displayed crash the app

What behavior are you expecting?

The ActionSheet should not be crashed, and the toast should be automatically closed

Steps to reproduce: use this code :

import { ActionSheetController , NavController, ToastController} from 'ionic-angular';
import {Component} from '@angular/core';


@Component({
  template: `
    <ion-header>
    <ion-navbar hideBackButton>
        <ion-title>Credits</ion-title>
    </ion-navbar>
</ion-header>

<ion-content padding class="has-header components-demo cards-bg social-cards">

  <button block (click)="openMenu()">
    Action sheet
  </button>


  <button block (click)="showToast('bottom')">Toast Bottom</button>
</ion-content>`,
})
export class CreditsMain {
  constructor(public nav: NavController,  private toastController : ToastController, private actionSheetController : ActionSheetController) { }


  showToast(position: string) {
    let toast = this.toastController.create({
      message: 'Mmmm, buttered toast',
      duration: 2000,
      position: position
    });

    toast.present();
  }


  openMenu() {
    let actionSheet = this.actionSheetController.create({
      title: 'Albums',
      buttons: [
        {
          text: 'Delete',
          role: 'destructive',
          icon: 'trash',
          handler: () => {}
        },
        {
          text: 'Cancel',
          role: 'cancel', // will always sort to be on the bottom
          icon: 'close',
          handler: () => {}
        }
      ]
    });

    actionSheet.present();
  }


}
  1. open the toast, and then the ActionSheet
  2. the app is crashed :

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)

browser_adapter.js:84 EXCEPTION: Error in ./AppRoot class AppRoot_Host - inline template:0:0

browser_adapter.js:84 ORIGINAL EXCEPTION: Expression has changed after it was checked. Previous value: 'false'. Current value: 'true'

Which Ionic Version? 1.x or 2.x ionic 2 beta 11

Run ionic info from terminal/cmd prompt: (paste output below)

Cordova CLI: 6.3.0 Ionic Framework Version: 2.0.0-beta.11 Ionic CLI Version: 2.0.0-beta.37 Ionic App Lib Version: 2.0.0-beta.20 OS: Node Version: v4.4.6

NB : probably related to https://github.com/driftyco/ionic/issues/7449, but we should be able to present a toast and let the ability to the user to continue using the app (that can have 'permanent' popover/modal/actionsheet buttons)..

Geoffrey-D avatar Aug 20 '16 09:08 Geoffrey-D

Hello! Thanks for opening an issue with us! This has actually already been fixed on another branch and will be in the beta.12 release. Thanks for using Ionic!

jgw96 avatar Aug 22 '16 15:08 jgw96