Skip to content

Commit

Permalink
fix(static-date-range-picker): fix panel interaction error
Browse files Browse the repository at this point in the history
  • Loading branch information
gavin-hao authored and jack0pan committed May 10, 2022
1 parent 1247635 commit 883944b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/static-date-picker/StaticDatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const StaticDatePicker: React.FC<StaticDatePickerProps> = ({
...restProps
}) => {
const locale = useLocale<Locale>('DatePicker') || defaultLocale;
const [viewDate, setViewDate] = useState(() => viewDateProp ?? value ?? defaultValue ?? new Date());
const [viewDate, setViewDate] = useControlledState(viewDateProp, value ?? defaultValue ?? new Date());
const [innerValue] = useControlledState(value, defaultValue);
const [mode] = useState<PickerMode>('date');
const currentPickerMode = useRef(mode);
Expand Down Expand Up @@ -77,12 +77,12 @@ const StaticDatePicker: React.FC<StaticDatePickerProps> = ({
{...restProps}
pickerValue={viewDate}
onSelect={(date) => { onSelect?.(date); }}
onChange={(date) => { setViewDate(date) }}
onChange={(date) => { setViewDate(date); }}
locale={locale}
prefixCls={prefixCls}
onPanelChange={(changedValue, changedMode: PickerMode) => {
currentPickerMode.current = changedMode;
setViewDate(changedValue);
setViewDate(changedValue, true);
onPanelChange?.(changedValue, changedMode);
}}
picker={mode}
Expand Down

0 comments on commit 883944b

Please sign in to comment.