Skip to content

Commit

Permalink
fix: remove default props from function component to support 18.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tum-more authored and tam315 committed Apr 14, 2023
1 parent a8d9018 commit eb87c6a
Showing 1 changed file with 17 additions and 39 deletions.
56 changes: 17 additions & 39 deletions src/ReactCompareImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,45 +21,26 @@ interface IProps {
vertical?: boolean;
}

const defaultProps = {
aspectRatio: 'taller',
handle: null,
handleSize: 40,
hover: false,
leftImageAlt: '',
leftImageCss: {},
leftImageLabel: null,
onSliderPositionChange: () => {},
rightImageAlt: '',
rightImageCss: {},
rightImageLabel: null,
skeleton: null,
sliderLineColor: '#ffffff',
sliderLineWidth: 2,
sliderPositionPercentage: 0.5,
vertical: false,
};

const ReactCompareImage: React.FC<IProps> = props => {
const ReactCompareImage: React.FC<IProps> = (props: IProps) => {
const {
aspectRatio,
handle,
handleSize,
hover,
aspectRatio = 'taller',
handle = null,
handleSize = 40,
hover = false,
leftImage,
leftImageAlt,
leftImageCss,
leftImageLabel,
onSliderPositionChange,
leftImageAlt = '',
leftImageCss = {},
leftImageLabel = null,
onSliderPositionChange = () => {},
rightImage,
rightImageAlt,
rightImageCss,
rightImageLabel,
skeleton,
sliderLineColor,
sliderLineWidth,
sliderPositionPercentage,
vertical,
rightImageAlt = '',
rightImageCss = {},
rightImageLabel = null,
skeleton = null,
sliderLineColor = '#ffffff',
sliderLineWidth = 2,
sliderPositionPercentage = 0.5,
vertical = false,
} = props;

const horizontal = !vertical;
Expand Down Expand Up @@ -435,7 +416,4 @@ const ReactCompareImage: React.FC<IProps> = props => {
);
};

// @ts-ignore
ReactCompareImage.defaultProps = defaultProps;

export default ReactCompareImage;

0 comments on commit eb87c6a

Please sign in to comment.