Do not render Animate when not in need

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev committed 2022-04-01 15:22:03 +03:00
1 parent 71834e9fb2
commit 5a684513fe
1 file changed
+5 -1
+5 -1
View File
@@ -90,9 +90,13 @@ export class Animate extends React.Component<AnimateProps> {
"--leave-duration": `${leaveDuration}ms`,
} as React.CSSProperties;
if (!this.isVisible) {
return null;
}
return React.cloneElement(contentElem, {
className: cssNames("Animate", name, contentElem.props.className, this.statusClassName),
children: this.isVisible ? contentElem.props.children : null,
children: contentElem.props.children,
style: {
...contentElem.props.style,
...durations,