fix(ui): ensure that group animations are enabled after mount

This commit is contained in:
Łukasz Mierzwa
2020-06-18 19:35:26 +01:00
committed by Łukasz Mierzwa
parent 71839b0504
commit 17179f44b1
2 changed files with 8 additions and 1 deletions

View File

@@ -162,11 +162,15 @@ const AlertGroup = ({
const mountRef = useRef(null);
const [fadeDone, setFadeDone] = useState(false);
return useObserver(() => (
<div
ref={mountRef}
className={`components-grid-alertgrid-alertgroup ${
mountRef.current ? "components-animation-fade-appear-done" : ""
mountRef.current && fadeDone
? "components-animation-fade-appear-done"
: ""
}`}
style={{
width: groupWidth,
@@ -180,6 +184,7 @@ const AlertGroup = ({
in={context.animations.in}
duration={context.animations.duration}
wait={context.animations.duration}
onReveal={() => setFadeDone(true)}
>
<div
className={`card ${cardBackgroundClass}`}

View File

@@ -111,6 +111,8 @@ describe("<AlertGroup />", () => {
.hasClass("components-animation-fade-appear-done")
).toBe(false);
tree.setProps({});
act(() => tree.find("RevealBase").at(0).props().onReveal());
tree.update();
expect(
tree
.find("div.components-grid-alertgrid-alertgroup")