diff --git a/src/components/FieldDateRangeInput/DateRangeInput.js b/src/components/FieldDateRangeInput/DateRangeInput.js index 1615fc3d..2925349c 100644 --- a/src/components/FieldDateRangeInput/DateRangeInput.js +++ b/src/components/FieldDateRangeInput/DateRangeInput.js @@ -138,12 +138,12 @@ class DateRangeInputComponent extends Component { this.onFocusChange = this.onFocusChange.bind(this); } - componentWillReceiveProps(nextProps) { + componentDidUpdate(prevProps) { // Update focusedInput in case a new value for it is // passed in the props. This may occur if the focus // is manually set to the date picker. - if (nextProps.focusedInput && nextProps.focusedInput !== this.props.focusedInput) { - this.setState({ focusedInput: nextProps.focusedInput }); + if (this.props.focusedInput && this.props.focusedInput !== prevProps.focusedInput) { + this.setState({ focusedInput: this.props.focusedInput }); } } diff --git a/src/components/FieldDateRangeInput/FieldDateRangeInput.js b/src/components/FieldDateRangeInput/FieldDateRangeInput.js index 4ed4b4b7..dff25697 100644 --- a/src/components/FieldDateRangeInput/FieldDateRangeInput.js +++ b/src/components/FieldDateRangeInput/FieldDateRangeInput.js @@ -26,12 +26,12 @@ class FieldDateRangeInputComponent extends Component { this.handleFocus = this.handleFocus.bind(this); } - componentWillReceiveProps(nextProps) { + componentDidUpdate(prevProps) { // Update focusedInput in case a new value for it is // passed in the props. This may occur if the focus // is manually set to the date picker. - if (nextProps.focusedInput && nextProps.focusedInput !== this.props.focusedInput) { - this.setState({ focusedInput: nextProps.focusedInput }); + if (this.props.focusedInput && this.props.focusedInput !== prevProps.focusedInput) { + this.setState({ focusedInput: this.props.focusedInput }); } }