Replies: 1 comment 3 replies
-
Hi @aminsaedi. An alternative approach, instead of adding a separate state entry for Something like: // Visibility state can be:
// - "visible"
// - "hidden-with-animation"
// - "hidden-without-animation"
const [visibility, setVisibility] = useState("hidden-with-animation");
function showModal () {
setVisibility("visible");
}
function hideModalWithAnimation () {
setVisibility("hidden-with-animation");
}
function hideModalWithoutAnimation () {
setVisibility("hidden-without-animation");
}
return (
<Modal
isVisibile={visibility === "visible"}
animationOut={"hidden-with-animation" ? 300 : 0}
>
</Modal>
) |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi.
I'm looking for a way to close the modal immediately and without animation. I can't set
animationOutTiming
to zero because it some situations i need the animationI implemented this by setting a state for
animationOutTiming
and when i want to close it change state to zero and then changeisVisible
to false, but i guess there is a better way.Beta Was this translation helpful? Give feedback.
All reactions