TuckerMassad / react-animated-counter

React Animated Counter Component
MIT License
66 stars 12 forks source link

Having a font size that changes breaks the component #17

Open jnovak-SM2Dev opened 1 month ago

jnovak-SM2Dev commented 1 month ago

If you set the size of the font to something that scales like 2vw, the numbers don't align properly. Is there a way to tell the component to reload or a way to have it listen to window resize?

Example: https://codesandbox.io/p/sandbox/nostalgic-dan-3k5dsc?file=%2Fsrc%2FApp.js%3A5%2C20

TuckerMassad commented 1 month ago

Nice bug find here! @jnovak-SM2Dev I appreciate the reproduction environment, I'm going to brainstorm a solution here and run it by you in the next few days. Will keep you posted!

jnovak-SM2Dev commented 1 month ago

Sounds good. Thanks!

What I ended up doing was adding in react-resize-detector and forcing a rebuild on the component.