Skip to content

Commit

Permalink
fix(DatePicker): fix default import from external package
Browse files Browse the repository at this point in the history
  • Loading branch information
ajkl2533 committed May 6, 2024
1 parent 87e9cce commit 5d31008
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@ import React, { useRef, useState } from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { noop } from 'ramda-adjunct';
import DatePicker from 'react-datepicker';
import ReactDatePicker from 'react-datepicker';

import { datePickerStyles, singleDatePickerStyles } from './styles';
import { SingleDatePickerProps } from './SingleDatePicker.types';
import { DatePickerCustomHeader } from './CustomHeader';
import { CLX_COMPONENT } from '../../../theme/constants';

/**
* The imports in "react-datepicker" are strangely done and after migration to Vite
* the default import stopped working. This should point React to use the coorect import
*/
const DatePicker =
(ReactDatePicker as unknown as { default: typeof ReactDatePicker }).default ??
ReactDatePicker;

export const StyledDatePicker = styled.div`
${datePickerStyles}
${singleDatePickerStyles}
Expand Down

0 comments on commit 5d31008

Please sign in to comment.