Skip to content

Commit

Permalink
Revert "fix: react defaultProps warning (#363)"
Browse files Browse the repository at this point in the history
This reverts commit 343fc01.
  • Loading branch information
MadCcc committed Dec 14, 2022
1 parent ea04ecb commit 3335f6a
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions src/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,7 @@ export interface DrawerProps
getContainer?: PortalProps['getContainer'];
}

// Default Value.
// Since spread with default value will make this all over components.
// Let's maintain this in one place.
const defaultProps = {
open: false,
prefixCls: 'rc-drawer',
placement: 'right' as Placement,
autoFocus: true,
keyboard: true,
width: 378,
mask: true,
maskClosable: true,
};

const Drawer: React.FC<DrawerProps> = drawerProps => {
const props = {
...defaultProps,
...drawerProps,
};
const Drawer: React.FC<DrawerProps> = props => {
const {
open,
getContainer,
Expand Down Expand Up @@ -83,6 +65,20 @@ const Drawer: React.FC<DrawerProps> = drawerProps => {
);
};

// Default Value.
// Since spread with default value will make this all over components.
// Let's maintain this in one place.
Drawer.defaultProps = {
open: false,
prefixCls: 'rc-drawer',
placement: 'right',
autoFocus: true,
keyboard: true,
width: 378,
mask: true,
maskClosable: true,
};

if (process.env.NODE_ENV !== 'production') {
Drawer.displayName = 'Drawer';
}
Expand Down

0 comments on commit 3335f6a

Please sign in to comment.