fixing magic code input error (#2514)
Co-authored-by: pory-gone <pory-gone@kali>
This commit is contained in:
parent
4df6cfad91
commit
3df155f4f1
@ -1451,6 +1451,7 @@ export function MultiInput ({
|
|||||||
onChange, autoFocus, hideError, inputType = 'text',
|
onChange, autoFocus, hideError, inputType = 'text',
|
||||||
...props
|
...props
|
||||||
}) {
|
}) {
|
||||||
|
const formik = useFormikContext()
|
||||||
const [inputs, setInputs] = useState(new Array(length).fill(''))
|
const [inputs, setInputs] = useState(new Array(length).fill(''))
|
||||||
const inputRefs = useRef(new Array(length).fill(null))
|
const inputRefs = useRef(new Array(length).fill(null))
|
||||||
const [, meta, helpers] = useField({ name })
|
const [, meta, helpers] = useField({ name })
|
||||||
@ -1549,7 +1550,7 @@ export function MultiInput ({
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{hideError && meta.touched && meta.error && ( // custom error message is showed if hideError is true
|
{hideError && formik.submitCount > 0 && meta.touched && meta.error && ( // custom error message is showed if hideError is true
|
||||||
<BootstrapForm.Control.Feedback type='invalid' className='d-block'>
|
<BootstrapForm.Control.Feedback type='invalid' className='d-block'>
|
||||||
{meta.error}
|
{meta.error}
|
||||||
</BootstrapForm.Control.Feedback>
|
</BootstrapForm.Control.Feedback>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user