Custom inertial spring used to work on canary.808.17, but not in rc3
See original GitHub issue🐛 Bug Report
I previously implemented a rubberbanding drag slider with react-use-gesture and react-spring that used to work quite well based upon dbusmut’s initial code for something similar. This used to work with the new decay and initial velocity functions introduced in earlier versions of 9 quite well. It has now stopped working after updating to rc3. It seems to be something to do with triggering a state update at the same time as updating the spring value which seems to affect the onchange prop on the spring from executing as expected.
The repro should display the issue, toggling the state update before flinging the drag handle should highlight the difference in the way react-spring reacts.
To Reproduce
Try updating state at the end of a drag event from react-use-gesture, whilst updating a spring with decay enabled with an initial velocity.
Expected behavior
The code used to work before rc3, it should limit the animation of the drag handle to its confines whilst allowing rubberbanding whilst being dragged.
Link to repro (highly encouraged)
Environment
react-spring
v9.0.0-rc.3react
v16.8.6
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
💃🏻
This works perfectly for me - https://codesandbox.io/s/inertial-spring-react-spring-v920-beta0-kyq3d, it’s not doing the jumping to the end value, ignoring the decay animation, at the end anymore. So 10/10 from me 😋