diff --git a/components/time-picker/index.tsx b/components/time-picker/index.tsx index e3ee70e13d..e77356aed6 100644 --- a/components/time-picker/index.tsx +++ b/components/time-picker/index.tsx @@ -70,13 +70,6 @@ export default class TimePicker extends React.Component { focusOnOpen: true, }; - static getDerivedStateFromProps(nextProps: TimePickerProps) { - if ('value' in nextProps) { - return { value: nextProps.value }; - } - return null; - } - private timePickerRef: typeof RcTimePicker; constructor(props: TimePickerProps) { @@ -93,6 +86,12 @@ export default class TimePicker extends React.Component { }; } + componentWillReceiveProps(nextProps: TimePickerProps) { + if ('value' in nextProps) { + this.setState({ value: nextProps.value }); + } + } + handleChange = (value: moment.Moment) => { if (!('value' in this.props)) { this.setState({ value });