sanniassin / react-input-mask

Input masking component for React. Made with attention to UX.
MIT License
2.23k stars 255 forks source link

maxLength warning even when the prop isn't there #140

Closed dbalatero closed 6 years ago

dbalatero commented 6 years ago

When I render InputMask, I get this warning:

warning @ browser.js:49
componentDidMount @ react-input-mask.development.js:964
commitLifeCycles @ react-dom.development.js:9698
commitAllLifeCycles @ react-dom.development.js:11349
callCallback @ react-dom.development.js:104

However, this property is not being passed in anywhere in my codebase. I think there is something wrong with the warning library, because when I dropped into a debugger, I was able to make a warning fire even when the first argument was false: warning(false, "my warning")

This is happening on the latest 2.0 beta. Thanks!

dbalatero commented 6 years ago

@sanniassin looking at the docs for this:

https://www.npmjs.com/package/warning

It looks like it will fire the warning if the first argument is false. This is really confusing, I would assume warning(true, "a warning") would fire, but I guess they went with double-negatives.

sanniassin commented 6 years ago

Yes, it's "warn if condition is falsy". Can you provide a demo please?

sanniassin commented 6 years ago

Nevermind, it's a bug in react-input-mask. I got confused by falsy condition in warning too :)

sanniassin commented 6 years ago

Released 2.0.0-beta.4