pmndrs / react-spring

✌️ A spring physics based React animation library
http://www.react-spring.dev/
MIT License
27.73k stars 1.18k forks source link

[bug]: animated.div exception removes the zeros from the end of the number. #2265

Open lomocc opened 3 months ago

lomocc commented 3 months ago

Which react-spring target are you using?

What version of react-spring are you using?

9.7.3

What's Wrong?

animated.div will remove the .00 end of the number

To Reproduce

https://codesandbox.io/p/sandbox/ecstatic-https-t8kt3d?file=%2Fsrc%2FApp.tsx%3A14%2C9

first click the number, second click the update.

Expected Behaviour

<animated.div className={styles.content}>{props.width.to(x => x.toFixed(2))}</animated.div>

should always display the toFixed(2) number, just like 200.00

Link to repo

https://codesandbox.io/p/sandbox/ecstatic-https-t8kt3d?file=%2Fsrc%2FApp.tsx%3A14%2C9