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.

Animate.css classes are not working with cssTransition

See original GitHub issue

Do you want to request a feature or report a bug? Report a bug.

What is the current behavior? Animate.css classes like slideInUp should work with cssTransition but it is not the case.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn’t have dependencies other than React. Paste the link to your CodeSandbox (https://codesandbox.io/s/new) example below:

Here is my current setup to be able to use Slide transitions with cssTransition.

const CloseButton = () => <span className="icon-close toaster__icon" />;

toast.configure({
    className: 'toaster-container',
    toastClassName: 'toaster',
    bodyClassName: 'toaster__message',
    closeButton: <CloseButton />,
    hideProgressBar: true,
    position: 'top-center',
    transition: cssTransition({
        enter: `Toastify__slide-enter`,
        exit: `Toastify__slide-exit`,
        duration: [350, 1400],
        appendPosition: true,
    }),
});

I’ve tried to use the following cssTransition configuration but it wasn’t working:

    transition: cssTransition({
        enter: `slideInDown`,
        exit: `slideOutUp`,
        duration: [350, 1400],
        appendPosition: true,
    }),

What is the expected behavior? Animate.css transitions should work with cssTransition.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? React 16 and the behavior should be the same on any browser.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
PierrickGTcommented, Dec 23, 2020

hello @PierrickGT , sorry for the late reply. So the first code sandbox works because it uses the built-in transition provided by the library. There are 4 of them:

  • bounce
  • slide
  • zoom
  • flip Your first example could have been written as follow.
toast.configure({
  // others options
  transition: Slide
});

Your second example does not work because the class names you are using slideIn and slideOut doesn’t exist. If you want to you a custom animation and not a built-in you have to provide the corresponding css as well.

In your case, you probably need to import animate.css as well.

Thanks for the explanation!

0reactions
fkhadracommented, Dec 23, 2020

hello @PierrickGT , sorry for the late reply. So the first code sandbox works because it uses the built-in transition provided by the library. There are 4 of them:

  • bounce
  • slide
  • zoom
  • flip Your first example could have been written as follow.
toast.configure({
  // others options
  transition: Slide
});

Your second example does not work because the class names you are using slideIn and slideOut doesn’t exist. If you want to you a custom animation and not a built-in you have to provide the corresponding css as well.

In your case, you probably need to import animate.css as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Css transition not working with css animation - Stack Overflow
The problem is that CSS animation animates the background color, but doesn't change the value. There is no transition once you stop hovering ......
Read more >
CSS Animations Not Working? Try These Fixes - HubSpot Blog
Learn how to fix common CSS animation error and get your animations looking how you want them.
Read more >
Using CSS transitions - CSS: Cascading Style Sheets | MDN
CSS transitions provide a way to control animation speed when changing CSS properties. Instead of having property changes take effect ...
Read more >
Developers - Animate.css classes are not working with cssTransition -
Coming soon: A brand new website interface for an even better experience!
Read more >
An Interactive Guide to CSS Transitions - Josh W Comeau
The most fundamental and critical piece, though, is the humble CSS transition. It's the first animation tool that most front-end devs learn, ...
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