-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add "exitBeforeEnter" prop to useTransition #1064
Comments
This definitely is a pain point for me. It can now be "simulated" using the Vue.js also offers similar functionality with "transition modes" https://vuejs.org/v2/guide/transitions.html#Transition-Modes |
I actually think that this functionality could be achieved just using the public react spring API, specifically using the You could extract it into your own "useSwitch" or similar one. I'll try to whip up a PoC and post a Codesandbox link here later this week |
First of all, thank you for your PoC! It's a great workaround that uses the physic config! Unfortunately I struggle implementing it with a single component that should leave and enter on each prop changes like I explained here: Do you think it's feasable with a single component? @tomdohnal |
I've released this on |
@joshuaellis My goal is to show two blocks and change them with a timeout (check the sandbox). For some reason, the animated components are gone when I change the tab in the browser for around 5 sec. I cannot reproduce that without Codesandbox: Video example |
Hello @yaroslavdraha , I'd like to know if your problem was solved. Thanks, |
🚀 Feature Proposal
Add
exitBeforeEnter
property touseTransition
hook. This property would be an optional boolean that when set will wait for "leave" animation to complete before starting "enter" animation of new element. Ideally we would also not need to worry about layout issues here and implement "hacks" like absolute positioning.Motivation
I came across an issue similar to one described here #583
Essentially I want to create a page transition, where "initial" page fades out and only after it is not visible anymore "secondary" page fades in. This should be achievable without complex logic and delays.
Idea is taken from framer motion https://www.framer.com/api/motion/animate-presence/#animatepresenceprops.exitbeforeenter
I am down to try and implement this, but I am not sure where to start and if this is something that falls into the scope of the library.
Example
The text was updated successfully, but these errors were encountered: