DayPickerInput prefers typed value over controlled value #1119
Unanswered
MitchRivet
asked this question in
Support
Replies: 2 comments
-
I believe this is the same issue as: |
Beta Was this translation helpful? Give feedback.
0 replies
-
We have the same issue in our application. In version 7.0.7 it works fine. I propose different solution, but I am not sure, if this doesn't break some other use case
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
reproduction here: https://codesandbox.io/s/0yjvkzm3vn
I know this is a very specific example, but it has come up in my particular use case. In the example above, I have a DayPickerInput with a controlled value. When I type an invalid date into the input, and the value is updated (from outside of the component) the typed valid is not cleared. This is the opposite behavior when the user changes the date from the input's overlay.
This happens because of the order of variables in the OR condition here: https://github.com/gpbl/react-day-picker/blob/master/src/DayPickerInput.js#L569
It seems like switching the order of those two variables would be the desired approach (this.state.value is the source of truth for the input's value)
Beta Was this translation helpful? Give feedback.
All reactions