mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-04 04:58:55 +08:00
fix(date-picker): fix open prop
This commit is contained in:
parent
f52b087194
commit
ee1beaa459
@ -12,7 +12,6 @@ import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
import warning from '../_util/warning';
|
||||
import interopDefault from '../_util/interopDefault';
|
||||
import { RangePickerValue, RangePickerPresetRange } from './interface';
|
||||
import { PickerProps } from './createPicker';
|
||||
|
||||
export interface RangePickerState {
|
||||
value?: RangePickerValue;
|
||||
@ -125,8 +124,8 @@ class RangePicker extends React.Component<any, RangePickerState> {
|
||||
};
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps: PickerProps) {
|
||||
if ('open' in prevProps && prevProps.open) {
|
||||
componentDidUpdate(prevProps: any, prevState: RangePickerState) {
|
||||
if (!('open' in prevProps) && prevState.open) {
|
||||
this.focus();
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import classNames from 'classnames';
|
||||
import Icon from '../icon';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
import interopDefault from '../_util/interopDefault';
|
||||
import { PickerProps } from './createPicker';
|
||||
|
||||
function formatValue(value: moment.Moment | null, format: string): string {
|
||||
return (value && value.format(format)) || '';
|
||||
@ -56,8 +55,8 @@ class WeekPicker extends React.Component<any, WeekPickerState> {
|
||||
};
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps: PickerProps) {
|
||||
if ('open' in prevProps && prevProps.open) {
|
||||
componentDidUpdate(prevProps: any, prevState: WeekPickerState) {
|
||||
if (!('open' in prevProps) && prevState.open) {
|
||||
this.focus();
|
||||
}
|
||||
}
|
||||
|
@ -70,8 +70,8 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
|
||||
};
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps: PickerProps) {
|
||||
if ('open' in prevProps && prevProps.open) {
|
||||
componentDidUpdate(prevProps: PickerProps, prevState: PickerState) {
|
||||
if (!('open' in prevProps) && prevState.open) {
|
||||
this.focus();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user