Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] Animation ends event for child #3112

Open
SerhiiTsybulskyi opened this issue Mar 11, 2025 · 0 comments
Open

[QUESTION] Animation ends event for child #3112

SerhiiTsybulskyi opened this issue Mar 11, 2025 · 0 comments

Comments

@SerhiiTsybulskyi
Copy link

SerhiiTsybulskyi commented Mar 11, 2025

Question

Is there a way natively to know when all parent animations have been completed?

Problem

I have 2 components, one of the components is a drawer and the other sits inside the drawer. The problem is I need to know when the drawer animation is complete before I can load the component since it depends on position calculations.

These components are decoupled/generic components so listening for specific events will tightly couple them.

Thoughts

There are a few potential ideas I had:

  • Implement my own animation context in react but this is quite messy and from my understanding motion should already have this context natively.
  • Trigger window resize and listen on the child in order for it to know when to calculate but this has potential for causing performance issues and is kinda hacky.

Reproduction

Below you can see a example and video of the situation.

https://codesandbox.io/p/devbox/romantic-clarke-ythv6f

Screen.Recording.2025-03-11.at.17.24.12.mov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant