Skip to content

onRest is not called for immediate animations #362

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

Closed
jacobrask opened this issue Dec 10, 2018 · 2 comments
Closed

onRest is not called for immediate animations #362

jacobrask opened this issue Dec 10, 2018 · 2 comments
Labels
kind: request New feature or request that should be actioned
Milestone

Comments

@jacobrask
Copy link
Contributor

I would expect either neither onStart or onRest, or both, be called with an immediate animation. Instead only onStart is called. This causes some issues in our application because I want to render the content slightly differently (lower quality images) if we are currently in an active animation. If I setState({ isAnimating: true }) in onStart it will not be reset if the animation is was in immediate mode.

<Spring
  immediate
  from={{ height: 10 }}
  to={{ height: 100 }}
  onStart={() => console.log("start")}
  onRest={() => console.log("rest")}
>
  {({ height }) => <div style={{ background: "hotpink", height }} />}
</Spring>

Edit 8lzp570382

@drcmda
Copy link
Member

drcmda commented Dec 20, 2018

That's generally a hard call, theres some async stuff that relies on a started spring to conclude, for instance keyframes or now useChain. If a spring could just "do nothing" when started, promises would potentionally never finish. Do you need it for something particular?

@jacobrask
Copy link
Contributor Author

jacobrask commented Dec 21, 2018

I am sliding between really large images and I get better performance if I can replace them with lower quality thumbnails while the animation is active. When you first go to a link to a specific slide I want it to be immediate and don't scroll through all previous ones.

@aleclarson aleclarson changed the title onStart but not onRest not called on immediate animations onRest is not called for immediate animations Apr 1, 2019
@aleclarson aleclarson added the kind: request New feature or request that should be actioned label Apr 1, 2019
@aleclarson aleclarson mentioned this issue Apr 10, 2019
5 tasks
@aleclarson aleclarson added this to the v9.0.0 milestone Apr 23, 2019
cameron-martin pushed a commit to cameron-martin/react-spring that referenced this issue May 10, 2022
* Remove unnecessary filter from legend data generation in Bar/ BarCanvas component

* Fix fmt: Bar & BarCanvas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: request New feature or request that should be actioned
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants