Skip to content

Commit

Permalink
[pickers] Fix broken ref forwarding
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Jun 11, 2022
1 parent 4ab3a04 commit fedbf00
Show file tree
Hide file tree
Showing 18 changed files with 36 additions and 21 deletions.
3 changes: 2 additions & 1 deletion packages/mui-lab/src/CalendarPicker/CalendarPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ type CalendarPickerComponent = (<TDate>(
*/
const CalendarPicker = React.forwardRef(function DeprecatedCalendarPicker<TDate>(
props: CalendarPickerProps<TDate>,
ref: React.Ref<any>,
) {
warn();

return <XCalendarPicker {...props} />;
return <XCalendarPicker ref={ref} {...props} />;
}) as CalendarPickerComponent;

export default CalendarPicker;
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ type CalendarPickerSkeletonComponent = ((
*/
const CalendarPickerSkeleton = React.forwardRef(function DeprecatedCalendarPickerSkeleton(
props: CalendarPickerSkeletonProps,
ref: React.Ref<any>,
) {
warn();

return <XCalendarPickerSkeleton {...props} />;
return <XCalendarPickerSkeleton ref={ref} {...props} />;
}) as CalendarPickerSkeletonComponent;

CalendarPickerSkeleton.propTypes /* remove-proptypes */ = {
Expand Down
3 changes: 2 additions & 1 deletion packages/mui-lab/src/ClockPicker/ClockPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ type ClockPickerComponent = (<TDate>(
*/
const ClockPicker = React.forwardRef(function DeprecatedClockPicker<TDate>(
props: ClockPickerProps<TDate>,
ref: React.Ref<any>,
) {
warn();

return <XClockPicker {...props} />;
return <XClockPicker ref={ref} {...props} />;
}) as ClockPickerComponent;

export default ClockPicker;
3 changes: 2 additions & 1 deletion packages/mui-lab/src/DateTimePicker/DateTimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ type DateTimePickerComponent = (<TDate>(
*/
const DateTimePicker = React.forwardRef(function DeprecatedDateTimePicker<TDate>(
props: DateTimePickerProps<TDate>,
ref: React.Ref<any>,
) {
warn();

return <XDateTimePicker {...props} />;
return <XDateTimePicker ref={ref} {...props} />;
}) as DateTimePickerComponent;

DateTimePicker.propTypes /* remove-proptypes */ = {
Expand Down
3 changes: 2 additions & 1 deletion packages/mui-lab/src/DesktopDatePicker/DesktopDatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ type DesktopDatePickerComponent = (<TDate>(
*/
const DesktopDatePicker = React.forwardRef(function DeprecatedDesktopDatePicker<TDate>(
props: DesktopDatePickerProps<TDate>,
ref: React.Ref<any>,
) {
warn();

return <XDesktopDatePicker {...props} />;
return <XDesktopDatePicker ref={ref} {...props} />;
}) as DesktopDatePickerComponent;

DesktopDatePicker.propTypes /* remove-proptypes */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ type DesktopDateTimePickerComponent = (<TDate>(
*/
const DesktopDateTimePicker = React.forwardRef(function DeprecatedDesktopDateTimePicker<TDate>(
props: DesktopDateTimePickerProps<TDate>,
ref: React.Ref<any>,
) {
warn();

return <XDesktopDateTimePicker {...props} />;
return <XDesktopDateTimePicker ref={ref} {...props} />;
}) as DesktopDateTimePickerComponent;

DesktopDateTimePicker.propTypes /* remove-proptypes */ = {
Expand Down
3 changes: 2 additions & 1 deletion packages/mui-lab/src/DesktopTimePicker/DesktopTimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ type DesktopTimePickerComponent = (<TDate>(
*/
const DesktopTimePicker = React.forwardRef(function DeprecatedDesktopTimePicker<TDate>(
props: DesktopTimePickerProps<TDate>,
ref: React.Ref<any>,
) {
warn();

return <XDesktopTimePicker {...props} />;
return <XDesktopTimePicker ref={ref} {...props} />;
}) as DesktopTimePickerComponent;

DesktopTimePicker.propTypes /* remove-proptypes */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ type LocalizationProviderComponent = ((
*/
const LocalizationProvider = React.forwardRef(function DeprecatedLocalizationProvider(
props: LocalizationProviderProps,
ref: React.Ref<any>,
) {
warn();

return <XLocalizationProvider {...props} />;
return <XLocalizationProvider ref={ref} {...props} />;
}) as LocalizationProviderComponent;

LocalizationProvider.propTypes /* remove-proptypes */ = {
Expand Down
3 changes: 2 additions & 1 deletion packages/mui-lab/src/MobileDatePicker/MobileDatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ type MobileDatePickerComponent = (<TDate>(
*/
const MobileDatePicker = React.forwardRef(function DeprecatedMobileDatePicker<TDate>(
props: MobileDatePickerProps<TDate>,
ref: React.Ref<any>,
) {
warn();

return <XMobileDatePicker {...props} />;
return <XMobileDatePicker ref={ref} {...props} />;
}) as MobileDatePickerComponent;

MobileDatePicker.propTypes /* remove-proptypes */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ type MobileDateTimePickerComponent = (<TDate>(
*/
const MobileDateTimePicker = React.forwardRef(function DeprecatedMobileDateTimePicker<TDate>(
props: MobileDateTimePickerProps<TDate>,
ref: React.Ref<any>,
) {
warn();

return <XMobileDateTimePicker {...props} />;
return <XMobileDateTimePicker ref={ref} {...props} />;
}) as MobileDateTimePickerComponent;

MobileDateTimePicker.propTypes /* remove-proptypes */ = {
Expand Down
3 changes: 2 additions & 1 deletion packages/mui-lab/src/MobileTimePicker/MobileTimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ type MobileTimePickerComponent = (<TDate>(
*/
const MobileTimePicker = React.forwardRef(function DeprecatedMobileTimePicker<TDate>(
props: MobileTimePickerProps<TDate>,
ref: React.Ref<any>,
) {
warn();

return <XMobileTimePicker {...props} />;
return <XMobileTimePicker ref={ref} {...props} />;
}) as MobileTimePickerComponent;

MobileTimePicker.propTypes /* remove-proptypes */ = {
Expand Down
3 changes: 2 additions & 1 deletion packages/mui-lab/src/MonthPicker/MonthPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ type MonthPickerComponent = (<TDate>(
*/
const MonthPicker = React.forwardRef(function DeprecatedMonthPicker<TDate>(
props: MonthPickerProps<TDate>,
ref: React.Ref<any>,
) {
warn();

return <XMonthPicker {...props} />;
return <XMonthPicker ref={ref} {...props} />;
}) as MonthPickerComponent;

export default MonthPicker;
3 changes: 2 additions & 1 deletion packages/mui-lab/src/PickersDay/PickersDay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ type PickersDayComponent = (<TDate>(
*/
const PickersDay = React.forwardRef(function DeprecatedPickersDay<TDate>(
props: PickersDayProps<TDate>,
ref: React.Ref<any>,
) {
warn();

return <XPickersDay {...props} />;
return <XPickersDay ref={ref} {...props} />;
}) as PickersDayComponent;

PickersDay.propTypes /* remove-proptypes */ = {
Expand Down
3 changes: 2 additions & 1 deletion packages/mui-lab/src/StaticDatePicker/StaticDatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ type StaticDatePickerComponent = (<TDate>(
*/
const StaticDatePicker = React.forwardRef(function DeprecatedStaticDatePicker<TDate>(
props: StaticDatePickerProps<TDate>,
ref: React.Ref<any>,
) {
warn();

return <XStaticDatePicker {...props} />;
return <XStaticDatePicker ref={ref} {...props} />;
}) as StaticDatePickerComponent;

StaticDatePicker.propTypes /* remove-proptypes */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ type StaticDateTimePickerComponent = (<TDate>(
*/
const StaticDateTimePicker = React.forwardRef(function DeprecatedStaticDateTimePicker<TDate>(
props: StaticDateTimePickerProps<TDate>,
ref: React.Ref<any>,
) {
warn();

return <XStaticDateTimePicker {...props} />;
return <XStaticDateTimePicker ref={ref} {...props} />;
}) as StaticDateTimePickerComponent;

StaticDateTimePicker.propTypes /* remove-proptypes */ = {
Expand Down
3 changes: 2 additions & 1 deletion packages/mui-lab/src/StaticTimePicker/StaticTimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ type StaticTimePickerComponent = (<TDate>(
*/
const StaticTimePicker = React.forwardRef(function DeprecatedStaticTimePicker<TDate>(
props: StaticTimePickerProps<TDate>,
ref: React.Ref<any>,
) {
warn();

return <XStaticTimePicker {...props} />;
return <XStaticTimePicker ref={ref} {...props} />;
}) as StaticTimePickerComponent;

StaticTimePicker.propTypes /* remove-proptypes */ = {
Expand Down
3 changes: 2 additions & 1 deletion packages/mui-lab/src/TimePicker/TimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ type TimePickerComponent = (<TDate>(
*/
const TimePicker = React.forwardRef(function DeprecatedTimePicker<TDate>(
props: TimePickerProps<TDate>,
ref: React.Ref<any>,
) {
warn();

return <XTimePicker {...props} />;
return <XTimePicker ref={ref} {...props} />;
}) as TimePickerComponent;

TimePicker.propTypes /* remove-proptypes */ = {
Expand Down
6 changes: 2 additions & 4 deletions packages/mui-lab/src/YearPicker/YearPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ type YearPickerComponent = (<TDate>(
/**
* @ignore - do not document.
*/
const YearPicker = React.forwardRef(function DeprecatedYearPicker<TDate>(
props: YearPickerProps<TDate>,
) {
const YearPicker = function DeprecatedYearPicker<TDate>(props: YearPickerProps<TDate>) {
warn();

return <XYearPicker {...props} />;
}) as YearPickerComponent;
} as YearPickerComponent;

export default YearPicker;

0 comments on commit fedbf00

Please sign in to comment.