Toasts are not hidden when multiple toasts are shown
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:
- Create a button with click handler which shows new toast message
- 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
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!
Problem still remains..
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
looks like it's re-invented, before 3.5.0 it works fine for me, but now it won't :-(
@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
Hi @jgw96 for some reason its back after this weeks updates.
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
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
@jgw96 Hey Justin, this issue should probably be reopened.
Also facing this issue.
I've got the same problem.
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();
}
}
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.
@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
@jgw96 same issue
In ionic-angular 3.6.0 it's all good again!
KR Pitt
@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
facing the same problem? is there any solution on this till yet?
@CruzzRazor It's a version issue. I also fetched this issue. remove toast plugin and reinstall it.
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.