<Presence exitBeforeEnter>
<Show when={isShow()}>
<Motion.div class="grid grid-cols-2 fixed top-0 right-0 bg-red-500" initial={{ width: "0%" }} animate={{ width: "100%" }} exit={{ width: "0%" }}>
<Motion.div class="bg-black" initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ duration: 2 }} exit={{ opacity: 0 }} />
<div class="bg-pink-500">
<AiOutlineClose onclick={toggle} />
</div>
</Motion.div>
</Show>
</Presence>
#How to use Motion exit when exiting, when there are many by doing exit child first?
19 messages · Page 1 of 1 (latest)
I think that the presence component waits only for it's direct child to exit before removing them from dom.
So you'd need to make sure that the root motion element has an animation duration the same or longer then the child.
I assumed they were in order on exit as well because on initial they were in order.
they start entering and exiting immediately from what I remember
I tried adding delay but it didn't work.
In the current version the direct child will have the exit transition triggered first. But I guess that shouldn't matter much.
what happens?
It just slows down before exiting the same way without ordering the animation.
I could make the next version wait for all children exit before removing from dom. I didn't know how important it was, and the vue implementation I was basing this on didn't have this either.
What do you mean by "ordering" exactly?
You want the child to finish exiting before parent starts?
sorry for my translate i mean ```
initial > Motion 1 > Motion 2
Motion 2 > Motion 1 > exit
but it is Motion 1 > exit
when exit Motion 2 not trigger
ah
ok so I was overthinking the problem
I've made a PR to the library yesterday that should fix that - all children will start animating exit onCleanup
https://github.com/motiondivision/motionone/pull/176
i must use library "@solid-primitives/transition-group" for this problem?
Not directly, I'm making it a dependency of the motionone implementation.
It doesn't help with your problem directly, but I think I've fixed it while working on it.
Or at least made it more consistent - I would assume that the exit transition would be triggered in the current version as well.
If you want, you could build the package locally from the version on the pr and check if it does solve your issue.