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

Toasts are not hidden when multiple toasts are shown

Open stalniy opened this issue 10 years ago • 20 comments

Short description of the problem:

When multiple toasts are shown with duration field then only first toast is dismissed. All others present on the view with no respect to duration timeout.

What behavior are you expecting?

All toasts are hidden after duration timeout is exceeded

Steps to reproduce:

  1. Create a button with click handler which shows new toast message
  2. Click on that button multiple times

Other information: ionViewDidEnter called only for the first toast and not for others, so timeout is not even setup. When I comment out line https://github.com/driftyco/ionic/blob/2.0/src/components/toast/toast.ts#L84 then everything works as expected.

I believe there is a similar issue with Loading component.

Which Ionic Version? 1.x or 2.x 2.x

Plunker that shows an example of your issue

http://plnkr.co/edit/EqLn7l?p=preview

Run ionic info from terminal/cmd prompt: (paste output below) Cordova CLI: 6.2.0 Gulp version: CLI version 3.9.1 Gulp local:
Ionic Framework Version: 2.0.0-beta.8 Ionic CLI Version: 2.0.0-beta.30 Ionic App Lib Version: 2.0.0-beta.16 ios-deploy version: Not installed ios-sim version: 5.0.8 OS: Mac OS X Yosemite Node Version: v6.2.1 Xcode version: Xcode 7.2.1 Build version 7C1002

stalniy avatar Jun 14 '16 09:06 stalniy

Hello! Thanks for opening an issue with us. This has already been fixed and will be in the beta.9 release. If you would like to try it out early you can install Ionic 2 nightly by running npm install ionic-angular@nightly. Thanks for using Ionic!

jgw96 avatar Jun 14 '16 14:06 jgw96

Problem still remains..

Behnam-r avatar Jul 09 '17 10:07 Behnam-r

The issue remains, when show 2 or more Toast from a Modal, only the first one dissapear it.

@ionic/cli-utils : 1.4.0 Cordova CLI : 7.0.1 Ionic CLI : 3.4.0 @ionic/app-scripts : 2.0.0 @ionic/cli-plugin-cordova : 1.4.0 @ionic/cli-plugin-ionic-angular : 1.3.1 Cordova Platforms : ios 4.4.0 Ionic Framework : ionic-angular 3.5.0

xDarp avatar Jul 09 '17 17:07 xDarp

looks like it's re-invented, before 3.5.0 it works fine for me, but now it won't :-(

pittdewaard avatar Jul 10 '17 15:07 pittdewaard

@pittdewaard yes, you are right. I am having the same issue after updation. My Ionic info is:

global packages:

@ionic/cli-plugin-proxy : 1.3.1
@ionic/cli-utils        : 1.4.0
Cordova CLI             : 7.0.1 
Ionic CLI               : 3.4.0

local packages:

@ionic/app-scripts              : 1.3.12
@ionic/cli-plugin-cordova       : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms               : ios 4.4.0
Ionic Framework                 : ionic-angular 3.5.0

System:

Node       : v8.1.3
OS         : macOS Sierra
Xcode      : Xcode 8.3.2 Build version 8E2002 
ios-deploy : 1.9.1 
ios-sim    : 6.0.0 
npm        : 5.1.0 

premcarver avatar Jul 11 '17 16:07 premcarver

Hi @jgw96 for some reason its back after this weeks updates.

bleuscyther avatar Jul 12 '17 06:07 bleuscyther

My package info: global packages:

@ionic/cli-plugin-proxy : 1.3.2
@ionic/cli-utils        : 1.5.0
Cordova CLI             : 7.0.1
Ionic CLI               : 3.5.0

local packages:

@ionic/app-scripts              : 2.0.1
@ionic/cli-plugin-cordova       : 1.4.1
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms               : android 6.2.3 windows 5.0.0
Ionic Framework                 : ionic-angular 3.5.0

System:

Node       : v6.10.3
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 5.2.0

bleuscyther avatar Jul 12 '17 06:07 bleuscyther

I am also facing the same problem.

global packages:

@ionic/cli-utils : 1.5.0
Cordova CLI      : 7.0.1
Ionic CLI        : 3.5.0

local packages:

@ionic/app-scripts              : 2.0.0
@ionic/cli-plugin-cordova       : 1.4.1
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms               : android 6.2.3
Ionic Framework                 : ionic-angular 3.5.0

System:

Node       : v8.1.3
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 5.0.4

monalisasaha79 avatar Jul 13 '17 12:07 monalisasaha79

@jgw96 Hey Justin, this issue should probably be reopened.

Chuckv01 avatar Jul 13 '17 16:07 Chuckv01

Also facing this issue.

QaseemLodhi avatar Jul 20 '17 10:07 QaseemLodhi

I've got the same problem.

hath74 avatar Jul 20 '17 15:07 hath74

We found a workaround running in version 3.5.0.

import { Injectable } from '@angular/core';
import { ToastController, Toast } from 'ionic-angular';

@Injectable()

export class ToastService {

    private toast: Toast;

    constructor(public toastCtrl: ToastController) { }

    presentToast(message: string, position: string, closeButton: boolean, css?: string) {
        if (closeButton) {
            var duration = null
        } else {
            duration = 3000;
        }
        if (this.toast) this.toast.dismiss();
        this.toast = this.toastCtrl.create({
            message: message,
            duration: duration,
            position: position,
            showCloseButton: closeButton,
            closeButtonText: 'Close',
            cssClass: css
        });
        this.toast.present();
    }
}

hath74 avatar Jul 20 '17 16:07 hath74

I'm having the same issue as well after updating to Ionic 3.5.0. I'll be using a ToastService wrapper workaround as well.

mjclyde avatar Jul 23 '17 20:07 mjclyde

@jgw96 Can this be reopened?

I'm experiencing it too. hath74's workaround worked for me.

PS. The AlertController does the same thing.

global packages:

@ionic/cli-utils : 1.5.0
Cordova CLI      : 6.5.0
Ionic CLI        : 3.5.0

local packages:

@ionic/app-scripts              : 2.0.1
@ionic/cli-plugin-cordova       : 1.4.1
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms               : android 6.2.3 ios 4.1.0
Ionic Framework                 : ionic-angular 3.5.0

System:

Node       : v6.11.1
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 3.10.10

herman1vdb avatar Jul 27 '17 06:07 herman1vdb

@jgw96 same issue

nakulkundaliya avatar Aug 04 '17 09:08 nakulkundaliya

In ionic-angular 3.6.0 it's all good again!

KR Pitt

pittdewaard avatar Aug 04 '17 12:08 pittdewaard

@jgw96 Same issue toast are stacked.


@ionic/cli-plugin-cordova       : 1.6.2
    @ionic/cli-plugin-ionic-angular : 1.4.1
    @ionic/cli-utils                : 1.7.0
    ionic (Ionic CLI)               : 3.7.0

global packages:

    Cordova CLI : 7.0.1 

local packages:

    @ionic/app-scripts : 2.1.3
    Cordova Platforms  : android 6.2.3
    Ionic Framework    : ionic-angular 3.6.0

System:

    Android SDK Tools : 25.2.5
    Node              : v6.11.1
    OS                : macOS Sierra
    Xcode             : Xcode 8.3.3 Build version 8E3004b 
    ios-deploy        : 1.8.6 
    ios-sim           : 5.0.8 
    npm               : 3.10.10 

ghost avatar Aug 05 '17 12:08 ghost

facing the same problem? is there any solution on this till yet?

CruzzRazor avatar Dec 19 '17 10:12 CruzzRazor

@CruzzRazor It's a version issue. I also fetched this issue. remove toast plugin and reinstall it.

nakulkundaliya avatar Dec 19 '17 11:12 nakulkundaliya

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 01 '18 14:09 ionitron-bot[bot]