fix: delete defaultprops (#37827)

This commit is contained in:
lijianan 2022-10-01 21:58:46 +08:00 committed by GitHub
parent e47e418c09
commit 3e2e12e98e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 14 deletions

View File

@ -31,7 +31,7 @@ export interface OverlayProps
onCancel?: React.MouseEventHandler<HTMLButtonElement>;
}
export function Overlay(props: OverlayProps) {
export const Overlay: React.FC<OverlayProps> = props => {
const {
prefixCls,
okButtonProps,
@ -78,4 +78,4 @@ export function Overlay(props: OverlayProps) {
)}
</LocaleReceiver>
);
}
};

View File

@ -77,7 +77,7 @@ const Popconfirm = React.forwardRef<unknown, PopconfirmProps>((props, ref) => {
};
const onOpenChange = (value: boolean) => {
const { disabled } = props;
const { disabled = false } = props;
if (disabled) {
return;
}
@ -86,7 +86,10 @@ const Popconfirm = React.forwardRef<unknown, PopconfirmProps>((props, ref) => {
const {
prefixCls: customizePrefixCls,
placement,
placement = 'top',
trigger = 'click',
okType = 'primary',
icon = <ExclamationCircleFilled />,
children,
overlayClassName,
...restProps
@ -98,12 +101,17 @@ const Popconfirm = React.forwardRef<unknown, PopconfirmProps>((props, ref) => {
return (
<Popover
{...restProps}
trigger={trigger}
prefixCls={prefixCls}
placement={placement}
onOpenChange={onOpenChange}
open={open}
ref={ref}
overlayClassName={overlayClassNames}
_overlay={
<Overlay
okType={okType}
icon={icon}
{...props}
prefixCls={prefixCls}
close={close}
@ -111,8 +119,6 @@ const Popconfirm = React.forwardRef<unknown, PopconfirmProps>((props, ref) => {
onCancel={onCancel}
/>
}
overlayClassName={overlayClassNames}
ref={ref as any}
>
{cloneElement(children, {
onKeyDown: (e: React.KeyboardEvent<any>) => {
@ -126,12 +132,4 @@ const Popconfirm = React.forwardRef<unknown, PopconfirmProps>((props, ref) => {
);
});
Popconfirm.defaultProps = {
placement: 'top' as PopconfirmProps['placement'],
trigger: 'click' as PopconfirmProps['trigger'],
okType: 'primary' as PopconfirmProps['okType'],
icon: <ExclamationCircleFilled />,
disabled: false,
};
export default Popconfirm;