react-input-mask: React does not recognize the `maskPlaceholder` prop on a DOM element.
When I try to make this lib work with my design system components I get:
React does not recognize the maskPlaceholderprop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercasemaskplaceholder instead. If you accidentally passed it from a parent component, remove it from the DOM element.
How to solve this?
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 11
- Comments: 16
Using
maskCharproperty instead ofmaskPlaceholderresolved the issue for meI guess
maskChar={null}should be used on v2. it got renamed tomaskPlaceholder={null}on3.0.0-alpha.0maskChar is accepted as prop, but it doesn’t work as expected. when i use
maskChar={null}, the input still renders underscores as placeholders. using any other string value instead of null gives the same result, e.g.maskChar="-"still renders with underscores. anyone else experiencing this behavior?@ivansolobear-ts that happens if you use
maskChar. To get the behaviour you want, usemaskPlaceholder.Note that you will have to install the
3.0.0-alpha.2version which includes support formaskPlaceholder. Uninstall the old version, and install the new one by doingyarn add react-input-mask@next. Then, restart your dev server (CRA, in my case), andmaskPlaceholderwill start working!Yes, but
maskPlaceholder={null}on3.0.0-alpha.0doesn’t work, at least in my case (maybe I did something wrong). So I removed alpha version and replace it withnpm install react-input-mask --save- “react-input-mask”: “^2.0.4”, And maskChar={null} working fine at this versionuse maskPlaceholder instead of maskChar in version 3.0.0-alpha.2
Instead of using
maskPlaceholder="dd/mm/yyyy"I just used a standard placeholder (i.e.placeholder="dd/mm/yyyy") and while it does not function exactly the same - it got the job done.any news on that? working with maskChar doesn’t give the wanted result , when i use maskChar={‘dd/mm/yyyy’} for example it turns every char to it so it turns to “dd/mm/yyyydd/mm/yyyydd/mm/yyyydd/mm/yyyydd/mm/yyyydd/mm/yyyydd/mm/yyyydd/mm/yyyy”.
as far as I understand it replaces every char to the string in maskChar. so this workaround does not work for cases where long string should replace long masks.