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

multiple messages do not dissapear #36

Closed
merkancam opened this issue Sep 13, 2019 · 4 comments
Closed

multiple messages do not dissapear #36

merkancam opened this issue Sep 13, 2019 · 4 comments

Comments

@merkancam
Copy link

If I show one message it disappears. No problem but if i show multiple messages then only first one disappears rest are keeps alive.

here is my message below

toast.lib.init({
text: message,
duration: 3000,
newWindow: false,
close: true,
gravity: "top",
position: 'right',
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
stopOnFocus: true,
}).showToast();

@apvarun
Copy link
Owner

apvarun commented Dec 24, 2019

Would be great if you could reproduce this issue. I tried by generating multiple toasts and it works as intended.
Reference: https://jsbin.com/mikekeqiqi/2/edit?html,js,output

@Illusionist3886
Copy link

@apvarun
Reproduced Issue: https://jsbin.com/minaziyuve/edit?html,js,output
It happens when we store the options on a js variable and trigger it on a mouse event.

@apvarun
Copy link
Owner

apvarun commented Aug 6, 2020

@Illusionist3886
This is related to how the library is designed. Each toast is expected to have its own instance. Create multiple toasts from one config is not the intended one.

Each toast is expected to have its own instance.

This is setup as such in order to have each of them controllable from JS


In order to achieve what you need, the following small changes could help

myToast = Toastify({ to myToast = () => Toastify({

myToast.showToast() to myToast().showToast()

Reference bin: https://jsbin.com/rafixuw/edit?html,js,output

@apvarun
Copy link
Owner

apvarun commented Mar 24, 2021

Closing this due to inactivity

@apvarun apvarun closed this as completed Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants