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

Stop returns undefined when using useSpring with callback function #637

Closed
josephrexme opened this issue Apr 16, 2019 · 4 comments
Closed
Labels
kind: bug Something isn't working
Milestone

Comments

@josephrexme
Copy link

🐛 Bug Report

Undefined is being returned for stop - the third optional return, when a callback function is passed into useSpring

To Reproduce

I have the following:

 const [motion, setMotion, stopMotion] = useSpring(() => ({
   transform: 'scaleX(0)',
   config: { ...config.default, duration: 180000 }
 }));

with the jsx:

<Track>
  <animated.div style={motion} />
</Track>

Expected behavior

I expect that setMotion and stopMotion will be functions I can use to start and end my animations and indeed setMotion works as expected when called as:

setMotion({ transform: 'scaleX(1)' });

However stopMotion keeps returning undefined.
(A clear and concise description of what you expected to happen.)

Link to repro (highly encouraged)

Here's a reproduced demo
CodeSandbox demo

Environment

  • react-spring v8.0.4
  • react v16.8.0
@josephrexme josephrexme added the kind: bug Something isn't working label Apr 16, 2019
@josephrexme
Copy link
Author

I noticed from this other demo that in version 8.0.19 I don't get undefined but the stop still doesn't stop my animation

@aleclarson
Copy link
Contributor

aleclarson commented Apr 16, 2019

This is probably fixed in #632

You can check by following this guide, except do this when cloning react-spring:

git clone https://github.com/react-spring/react-spring -b v9

..or wait for the beta.

@aleclarson
Copy link
Contributor

Fixed by #632 confirmed 🎉

Try out v9.0.0-beta like this: yarn add react-spring@next

Let us know if you hit any issues here: #642

@aleclarson aleclarson mentioned this issue Apr 21, 2019
5 tasks
@josephrexme
Copy link
Author

Thanks! I'll go ahead and close this now

@aleclarson aleclarson added this to the v9.0.0 milestone Apr 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants