thekaganugur/formik-chakra-ui

NumberInputControl parse the string value to number before set the form value

abdelrazzaq-dev opened this issue · 3 comments

Currently, the NumberInputControl sets the FieldValue as a string. it would be good if it parses the string to a number before sets the FieldValue

Thank you for opening an issue, yes it could be nice. I will look into it today or tomorrow.

Thank you for opening an issue, yes it could be nice. I will look into it today or tomorrow.

I could help with this!

I took a look at it. I tried to parse a string to Int 'onChange' it of course works on non-float numbers. But floating number experience is not good. When you start typing 2. it removes . on the fly.
But this works --> type 23 then put . between --> 2.3.
The workaround would be to parse it only on onBlur. But I don't think it's a good solution since it's not consistent and things could become messy for the API consumer.

If you have a suggestion it is of course welcome.