Open testinggithub1222 opened 5 years ago
Hey @testinggithub1222,
I had the same problem. I don't have a solution for you, but there is a workaround:
Since the onBlur stops the onChange event, you can delay onBlur by a tick:
<Field
onBlur={e => {
setTimeout(() => {
touched.username = true;
errors.username = "err";
console.log(e.target);
}, 0);
}}
name="username"
type="text"
placeholder="USERNAME"
className="form-control rounded register-form-control"
/>
That way the value update should succeed again.
If the same thing happens to me, is there a solution already?
heyo, i'm having the problem too
In my case, I need to asynchronously check username and email if it is already existed inside database. If it does, then i will show some message below my input textbox. To achieve that, I have tried to put handleOnBlur inside withFormik but none work :( so i give up on that idea and now I think it might be working by manually create function inside onBlur as below code by manually update touched and errors value onBlur:
The problem is that, after moving my current cursor out of username textbox to email, i have checked touched.username and errors.username value using react dev tool but i saw its value is empty. I think it should already update its value by now but seem like something went wrong here. The value is update after my cursor is move out of email only. Please help me.