🐛 Bug Report
Stringified or literal floats are being cast to integers when they are only significant to one value via useSpring.
To Reproduce
The described problem is immediately visible on mount, with no interpolation being done.
Try interpolating between a float that holds significance to another that does not (defined by default). Then try having react-spring animate back to the latter value — it's then converted to an integer.
Expected behavior
Springs should respect the highest precision and/or keep the output as a float. I'm not sure if the former is a regression, but it isn't a nice pattern to see.
As it's unclear if this behavior is done intentionally, I'm keeping this as a potential bug.
Link to repro (highly encouraged)
Try clicking on the centered number to animate and play around with the values as I outlined above.
Reproduction - Workaround
Environment
react-spring v9.1.2
react v17.0.2
🐛 Bug Report
Stringified or literal floats are being cast to integers when they are only significant to one value via
useSpring.To Reproduce
The described problem is immediately visible on mount, with no interpolation being done.
Try interpolating between a float that holds significance to another that does not (defined by default). Then try having react-spring animate back to the latter value — it's then converted to an integer.
Expected behavior
Springs should respect the highest precision and/or keep the output as a float. I'm not sure if the former is a regression, but it isn't a nice pattern to see.
As it's unclear if this behavior is done intentionally, I'm keeping this as a potential bug.
Link to repro (highly encouraged)
Try clicking on the centered number to animate and play around with the values as I outlined above.
Reproduction - Workaround
Environment
react-springv9.1.2reactv17.0.2