Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove default props from function component to support 18.3.0 #100

Merged
merged 1 commit into from
Apr 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;