Skip to content

Commit 3335f6a

Browse files
committed
Revert "fix: react defaultProps warning (#363)"
This reverts commit 343fc01.
1 parent ea04ecb commit 3335f6a

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

src/Drawer.tsx

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,7 @@ export interface DrawerProps
1717
getContainer?: PortalProps['getContainer'];
1818
}
1919

20-
// Default Value.
21-
// Since spread with default value will make this all over components.
22-
// Let's maintain this in one place.
23-
const defaultProps = {
24-
open: false,
25-
prefixCls: 'rc-drawer',
26-
placement: 'right' as Placement,
27-
autoFocus: true,
28-
keyboard: true,
29-
width: 378,
30-
mask: true,
31-
maskClosable: true,
32-
};
33-
34-
const Drawer: React.FC<DrawerProps> = drawerProps => {
35-
const props = {
36-
...defaultProps,
37-
...drawerProps,
38-
};
20+
const Drawer: React.FC<DrawerProps> = props => {
3921
const {
4022
open,
4123
getContainer,
@@ -83,6 +65,20 @@ const Drawer: React.FC<DrawerProps> = drawerProps => {
8365
);
8466
};
8567

68+
// Default Value.
69+
// Since spread with default value will make this all over components.
70+
// Let's maintain this in one place.
71+
Drawer.defaultProps = {
72+
open: false,
73+
prefixCls: 'rc-drawer',
74+
placement: 'right',
75+
autoFocus: true,
76+
keyboard: true,
77+
width: 378,
78+
mask: true,
79+
maskClosable: true,
80+
};
81+
8682
if (process.env.NODE_ENV !== 'production') {
8783
Drawer.displayName = 'Drawer';
8884
}

0 commit comments

Comments
 (0)