Which react-spring target are you using?
What version of react-spring are you using?
9.7.3
What's Wrong?
The onChange option in the SpringValue constructor indicates that the argument is of type AnimationResult<SpringValue<number>>
Thus, result.value is indicated to be of type number, and logging this should display the animated value. However, it actually prints undefined as the spring animates:
If I instead log the entire result, I see the number.
To Reproduce
import { SpringValue } from '@react-spring/web'
const spring = new SpringValue(0, {
onChange(result) {
console.log(result.value)
}
})
spring.start(1)
Expected Behaviour
I expect to see the value on result.value, which TypeScript indicates is a number
Link to repo
https://codesandbox.io/s/vigorous-mirzakhani-qrrwj8?file=/src/App.tsx
Which react-spring target are you using?
@react-spring/web@react-spring/three@react-spring/native@react-spring/konva@react-spring/zdogWhat version of react-spring are you using?
9.7.3
What's Wrong?
The
onChangeoption in theSpringValueconstructor indicates that the argument is of typeAnimationResult<SpringValue<number>>Thus,
result.valueis indicated to be of typenumber, and logging this should display the animated value. However, it actually prints undefined as the spring animates:If I instead log the entire
result, I see the number.To Reproduce
Expected Behaviour
I expect to see the value on
result.value, which TypeScript indicates is anumberLink to repo
https://codesandbox.io/s/vigorous-mirzakhani-qrrwj8?file=/src/App.tsx