question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

autoClose doesn't work if you don't include ReactToastify.css ?

See original GitHub issue

If I don’t include ReactToastify.css (which I’d prefer to omit than try to override everything I don’t want/need from there), the toasts remain until clicked rather than unmounting after the autoClose delay… would it be worth documenting or providing a minimal CSS workaround to support autoClose without the bundled CSS?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
dimre01commented, Jun 5, 2019

The styles provided in the Code Sandbox aren’t sufficient to make toasts auto-dismiss on Safari or Edge. We discovered that the following styles are necessary:

@keyframes Toastify__trackProgress {
  0% {
    transform: scaleX(1);
  }
  100% {
    transform: scaleX(0);
  }
}

.Toastify__progress-bar {
  animation: Toastify__trackProgress linear 1;
}
7reactions
fkhadracommented, Aug 22, 2018

Hello @DrMeers,

Thanks for the feedback.

The autoClose is triggered when the progress bar animation end. An onAnimationEnd event is bound to the component.

Regarding your needs, I see 1 easy workaround possible. In the sample below, open the style file to see the minimum style needed to trigger autoClose.

Edit 7mrx50r2w1

Read more comments on GitHub >

github_iconTop Results From Across the Web

React-toastify toasts don't close - Stack Overflow
However, whenever I click the x on the toasts they don't close. They do, however, close when I have autoClose: delay configured, as...
Read more >
Handling autoClose | React-Toastify - GitHub Pages
The autoClose prop accept a duration in milliseconds or false . #Change the default delay. Copy. import React from 'react';.
Read more >
Adding spinners and notifications to your React app
Notifications and loading spinners can go a long way toward making your React app more user-friendly. Learn how to implement them in an ......
Read more >
react-toastify - npm
If you use a style loader you can import the stylesheet as follow : import 'react-toastify/dist/ReactToastify.min.css' ...
Read more >
How to Setup Toast Notification for React Single Page ...
Libraries. I am using React Toastify for the purpose of this post, but there are plenty of toast libraries out there which you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found