Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
vractal-react-animated-transitions
Advanced tools
Demo.
yarn add react-transition-group react-animated-transitions animate.css
animate.css
is optional, without it you will have to write your own transition presets. The package includes only a single preset out of the box (a simple fade transition).
import Animated from 'react-animated-transitions';
// animate a child (when mounted/unmounted)
<Animated>
<Foo />
</Animated>
// animate a group of children
<Animated items>
{foos.map(() => <Animated item><Foo /></Animated>)}
</Animated>
animate.css
transition presetsList of available animations in animate.css
.
import 'animate.css'; // once, you don't need it if you are using your custom presets
// you can also create a custom build with only the presets you are using
// you can use any combination
<Animated enter="fadeIn" exit="fadeOut" />
<Animated enter="tada" exit="zoomOut" />
// you can import presets individually as well
import 'animate.css/source/attention_seekers/tada.css';
import 'animate.css/source/zooming_exits/zoomOut.css';
// when you import individually, you need add the duration to your css
/* duration.css */
// .animated {
// animation-duration: 1000ms;
// }
import './duration.css'; // after individual imports
Presets are not needed for <Animated items />
, you can use them with <Animated />
and <Animated item />
.
To pass a custom preset, you need to add its css first, which is based on react-transition-group.
/* foo.css */
.foo-appear,
.foo-enter {
/* transition state at 0% */
}
.foo-appear-active,
.foo-enter-active {
/* transition state at 100% */
/* transition definition */
}
.foo-exit {
/* transition state at 100% */
}
.foo-exit-active {
/* transition state at 0% */
/* transition definition */
}
/* example: fade.css */
.fade-appear,
.fade-enter {
opacity: 0;
}
.fade-appear-active,
.fade-enter-active {
opacity: 1;
transition: opacity 1000ms ease-in;
}
.fade-exit {
opacity: 1;
}
.fade-exit-active {
opacity: 0;
transition: opacity 1000ms ease-out;
}
Then in your JavaScript:
import './foo.css';
<Animated preset="foo" />; // notice that foo is used as a unique identifier in the css
The timeout should match the css transition duration.
<Animated timeout={500} /> // default is 1000ms
// different timeout for entrance and exit
<Animated timeout={{ enter: 750, exit: 500 }} />
animate.css
default durationanimate.css
presets have a default timeout of 1000ms, to change this number you can overwrite the css.
/* overwrite.css */
/* global */
.animated {
animation-duration: 3000ms;
}
/* specific */
.animated.fadeIn {
animation-duration: 3000ms;
}
Then in your JavaScript:
import './overwrite.css'; // make sure you include animate.css before this line
<Animated timeout={3000} />;
Sometimes you may want to prevent your component from animating, but it is still being wrapped in <Animated />
.
<Animated disabled />
Available here.
FAQs
Easy animated transitions in React.
The npm package vractal-react-animated-transitions receives a total of 1 weekly downloads. As such, vractal-react-animated-transitions popularity was classified as not popular.
We found that vractal-react-animated-transitions demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.