react-input-mask icon indicating copy to clipboard operation
react-input-mask copied to clipboard

InputMask contains an input of type undefined with both value and defaultValue props.

Open jsnavarroc opened this issue 3 years ago • 1 comments

When implementing the component, show this error.

Warning: InputMask contains an input of type undefined with both value and defaultValue props. Input elements must be either 
controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled
or uncontrolled input element and remove one of these props. More info: https://reactjs.org/link/controlled-components
 <InputMask
        {...leftover}
        mask={'99'}
        disabled={true}
        value={leftover.value || ''}
        defaultValue={leftover.defaultValue || ''}
        className={`input-time-text input-time ${disabledClass}`}
   />

jsnavarroc avatar May 07 '22 20:05 jsnavarroc

I'm using Formik + react-input-mask and my case missed including the field "initialValues={{". Example: < Formik innerRef={formikRef} initialValues={{ phone: '', }} My field looks like this:

{({ field }) => ( )} in your case you would have to see the more complete code.

ttasca avatar Apr 17 '23 13:04 ttasca