sanniassin / react-input-mask

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

defaultValue in documentation. #220

Open DickyMacias opened 4 years ago

DickyMacias commented 4 years ago

I am pretty new in this kind of collaboration, so I didn't know how to do it.

I had an issue when I use value to set a value from a fetch to fill the input. When I change the value, the mask's behavior was odd. After making some assumptions, I found that the best approach for this one, it was to use defaultValue to set the fetched value, and then when you change the value in the input, the behavior is pretty normal.

Hope this can help someone else, and maybe this is not the best way to ask for this change or maybe I should've opened a pull request after cloning the repo. If this information can be included in the documentation, would be great for newbies like me.

`<InputMask name="myInput" className={'form-control'} autoFocus {...setMyInputClass} onChange={handleMyInputChange} alwaysShowMask={true} mask={--*****} defaultValue={myInput} // using value instead defaultValue make an odd behavior

`

ssdev-95 commented 1 year ago

Up Here running in the same issue.