glennreyes / react-countup

💫 A configurable React component wrapper around CountUp.js
https://tr8tk.csb.app/
MIT License
2.01k stars 132 forks source link

separator is not working #75

Closed tutv closed 7 years ago

tutv commented 7 years ago
 <CountUp className="CountUp"
                     suffix="+"
                     separator=" "
                     decimals={4}
                     decimal=","
                     start={0} end={total}/>
//Result: 912800,0000+
//Expected: 912 800,0000+
glennreyes commented 7 years ago

Hey!

separator only works with useGrouping:

 <CountUp className="CountUp"
                     useGrouping
                     suffix="+"
                     separator=" "
                     decimals={4}
                     decimal=","
                     start={0} end={total}/>

See a live example here https://codesandbox.io/s/lrpz51mk9

tutv commented 7 years ago

👍 Thanks. It's working now :)

tutv commented 7 years ago

But I think when separator is not empty, component CoutuUp will auto detect useGrouping

glennreyes commented 7 years ago

Yeah seems like a good idea to add this behaviour. Would you mind to open a PR?

PS: if you set useGrouping only, a default value of separator will be used.