You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I kind of stumbled on a workaround for this. Kind of a workaround, but it's a very real problem we've been facing for a while.
If you assign the div a key, you can increment that key and force the component to unmount/remount. In this example, I kept the setFieldValue, but if you pull in handleReset from useFormikContext(), it'll also reset the touched and error states. Definitely open to critiques though!!!
🐛 Bug report
Current Behavior
When trying to clear an invalid date, "111" for example, with the
setFieldValue
function supplied byformik
the date displayed does not change.The error message and internal state are updated, but the displayed value remains the same.
Expected behavior
I expect the date field to have the internal state updated, and show the user a blank field.
Reproducible example
https://stackblitz.com/edit/react-availity-testing-zwwhzb?file=index.js
Example created by @nylon22
Suggested solution(s)
We expect the library
react-dates
to properly handle this situation. The issue could be coming from that libraryAdditional context
Your environment
The text was updated successfully, but these errors were encountered: