pmndrs / react-spring

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

[bug]: `AnimatedComponent` incorrectly interprets `className` prop as `class-name` attribute #2291

Closed LoganDark closed 2 weeks ago

LoganDark 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 className={springValue} /> only updates className each React render. When the springValue updates, then a class-name attribute is updated instead of className.

To Reproduce

Pass a FluidValue className to an AnimatedComponent.

Expected Behaviour

className should be updated, not class-name.

Link to repo

https://codesandbox.io/p/sandbox/dawn-platform-vclx4j

joshuaellis commented 3 months ago

why do you expect className to be animated value?

LoganDark commented 3 months ago

why do you expect className to be animated value?

I expect when I set className={springValue} for the className prop to be animated, not a class-name attribute. I don't expect className to always be anything in particular, I just want it to work in the rare case that I do want to animate it.

(If I pass class={springValue} it works, but that isn't idiomatic React.)