Closed magom001 closed 6 years ago
@magom001 why you had modified so much code?
@zengxiaoluan sorry about that: prettier formatted the code
@magom001 I don't see what you've changed =。=. How do you feel about adding a lock? Just let a DatePickerItem scroll.
I added:
componentDidUpdate() { const value = this.state.value; const { min, max } = this.props; if (value.getTime() > max.getTime()) { this.setState({ value: max }); }
It prevents the value to go outside of the min-max boundary
@magom001 Has been updated to react-mobile-datepicker@3.0.12
We encountered an issue with the datepicker: if the user scrolls month and day of the month at the same time, it is possible to set the value of the datepicker outside the boundary of the min-max. In this case the whole datepicker becomes greyed out and unusable.
I added componentDidUpdate lifecycle hook that checks if the state.value is within min-max. If it is <min, set the value to min. If it >max, set the value to max.