onRest gets called before onScroll callback gets fired. #1596
Unanswered
DamianPereira
asked this question in
Support
Replies: 1 comment 4 replies
-
You'd probably need to call But this is a pretty strange way of using springs. I'm going to move this to a discussion. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
🐛 Bug Report
When using onRest together with changing scroll position, the onRest callback gets called before all events fired are handled. I'm not sure if this is a bug or intended behavior.
To Reproduce
The idea of this code is to animate the scrolling of the div. But to differentiate in the handler if the div was scrolled by the animation, or manually. All scroll events end up on the "animation has scrolled" branch, except the last one, which ends up happening after the onRest callback.
Expected behavior
I need the last onScroll callback to be called before onRest, so I can differentiate if the animation is doing the scrolling or if the user is scrolling. If there is another way of checking this like imperatevely, asking react-spring if the animation is running (like some api.status() method?).
Link to repro (highly encouraged)
Codesandbox link
Environment
react-spring
v9.2.3react
v17.0.1Beta Was this translation helpful? Give feedback.
All reactions