react-maskedinput icon indicating copy to clipboard operation
react-maskedinput copied to clipboard

Mask doesn't update if value is changed.

Open Deiru2k opened this issue 9 years ago • 2 comments

I have a simple case: At first, the {value} of my masked input is undefined. Component then assumes this is starting value and sets it up as such. However, from this moment onward, masked input will only react to user input, and will ignore any subsequent changes made via altering the value prop. Is there any way to avoid this behavior, other than hiding the input until value is actually defined (which I can't do for reasons outside this discussion)?

Deiru2k avatar May 30 '16 15:05 Deiru2k

can you default the value to be '' rather than undefined at your call site? Something like:

<MaskedInput value={this.state.value || ''} />

iamdustan avatar Jun 02 '16 13:06 iamdustan

Are you using the latest code? I had the same issue, but @iamdustan fixed it in #30 (specifically this change)

davidleach avatar Jun 07 '16 22:06 davidleach