naikus / svg-gauge

Minimalistic, animated SVG gauge. Zero dependencies
MIT License
319 stars 74 forks source link

Animations not working in React #34

Closed JoeRoddy closed 5 years ago

JoeRoddy commented 5 years ago

Hi and thanks so much for making this!!

I was having issues getting my gauges to animate in a react project and thought maybe it was my setup. I created a codesandbox and just pasted the exact react example from the readme and the animations still do not fire.

Animations seem to work fine in a pure JS project.

You can check out the code sandbox here.

Let me know if I'm doing anything wrong.

JoeRoddy commented 5 years ago

I realized the current example just never calls setValue() before calling setValueAnimated(), which was the reason for the missing animation.

naikus commented 5 years ago

Hi @JoeRoddy, I'll take a look into this and update the documentation. Thanks!

JoeRoddy commented 5 years ago

Np! I submitted a PR with an updated react example that uses current syntax. Let me know if you want me to tweak anything @naikus