We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
Press the button to start the animation, and when the animation ends, unmount the component.
demo
The demo uses the onRest property to execute the function after the animation ends.
const [hold, setHold] = useState(false); const transitions = useTransition(hold, null, { config: config.molasses, from: { opacity: 0, transform: "translateY(100vh)" }, enter: { opacity: 1, transform: "translateY(0)" }, leave: { opacity: 0, transform: "translateY(100vh)" }, onRest: () => { if (hold) setToggle(false); } });
setHold (true) is executed in onMouseDown and setHold (false) is executed in onMouseUp. When setToggle (false) is executed, unmount the component.
setHold (true)
onMouseDown
setHold (false)
onMouseUp
setToggle (false)
However, repeated clicking without holding down the button can unmount the component before the animation ends.
Is there a way to unmount only when the animation has finished? Or is there anything missing from the demo code?
The text was updated successfully, but these errors were encountered:
Using the latest v9 canary, I've got it working: https://codesandbox.io/s/react-spring-issue-898-5kljn
All it took was updating the useTransition calls to the new API. More info here.
useTransition
PS: You can become my patron to support my work.
Sorry, something went wrong.
Thank you very much. Sorry for taking your time for a trivial question.
No branches or pull requests
🤓 Question
Press the button to start the animation, and when the animation ends, unmount the component.
demo
The demo uses the onRest property to execute the function after the animation ends.
setHold (true)
is executed inonMouseDown
andsetHold (false)
is executed inonMouseUp
.When
setToggle (false)
is executed, unmount the component.However, repeated clicking without holding down the button can unmount the component before the animation ends.
Is there a way to unmount only when the animation has finished?
Or is there anything missing from the demo code?
The text was updated successfully, but these errors were encountered: