NoHomey / material-ui-number-input

The <TextField type="number" /> that user really expects.

Home Page:http://nohomey.github.io/material-ui-number-input

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Validating number started falling without a reason. Value is not longer a String.

juanmav opened this issue · comments

Hi,

I dont know why the input started to fail. Out log:

Uncaught TypeError: value.match is not a function
    at Function.NumberInput.validateValue (NumberInput.js:103)

When I check the "value" variable is a number not a string.

Any ideas?

Thanks in advance!

I fixed it with monkey patched the functions NumberInput.getValidValue and NumberInput.validateValue adding this line value = value.toString();. Maybe anyone can help me with a better solution?

First sorry for closing the issue, I miss clicked. I did publish new patch version with a fix which work on mine machine. If it also works on yours I will update the docs. The fix was to change from event.target to event.currentTarget which required change in types. The events are now of type React.FormEvent<HTMLInputElement>.

Here is screenshot showing that it works on mine machine:

fixing_14

I have just publish one more patch version with which I migrated the package to use prop-types react package.

@NoHomey Thanks! I will try it tomorrow (Monday morning in Argentina) when I come back to the office.

@NoHomey I tested it and now the NumberInput.validateValue function is called twice one with value as string and another one as integer.