|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
import type { Dayjs } from 'dayjs';
|
|
|
|
|
import * as React from 'react';
|
|
|
|
|
import type { DatePickerProps, RangePickerProps } from '..';
|
|
|
|
|
import DatePicker from '..';
|
|
|
|
|
import type { DatePickRef, RangePickerRef } from '../generatePicker/interface';
|
|
|
|
|
|
|
|
|
@ -18,7 +19,7 @@ describe('DatePicker.typescript', () => {
|
|
|
|
|
|
|
|
|
|
// https://github.com/ant-design/ant-design/issues/33417
|
|
|
|
|
it('DatePicker ref methods with forwardRef', () => {
|
|
|
|
|
const MyDatePicker = React.forwardRef((props, ref: DatePickRef<Dayjs>) => (
|
|
|
|
|
const MyDatePicker = React.forwardRef((props: DatePickerProps, ref: DatePickRef<Dayjs>) => (
|
|
|
|
|
<DatePicker {...props} ref={ref} />
|
|
|
|
|
));
|
|
|
|
|
const datePicker = (
|
|
|
|
@ -45,9 +46,11 @@ describe('DatePicker.typescript', () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('RangePicker ref methods with forwardRef', () => {
|
|
|
|
|
const MyRangePicker = React.forwardRef((props, ref: RangePickerRef<Dayjs>) => (
|
|
|
|
|
<DatePicker.RangePicker {...props} ref={ref} />
|
|
|
|
|
));
|
|
|
|
|
const MyRangePicker = React.forwardRef(
|
|
|
|
|
(props: RangePickerProps, ref: RangePickerRef<Dayjs>) => (
|
|
|
|
|
<DatePicker.RangePicker {...props} ref={ref} />
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
const datePicker = (
|
|
|
|
|
<MyRangePicker
|
|
|
|
|
ref={(picker) => {
|
|
|
|
|