File tree Expand file tree Collapse file tree 1 file changed +19
-15
lines changed Expand file tree Collapse file tree 1 file changed +19
-15
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,25 @@ export interface DrawerProps
17
17
getContainer ?: PortalProps [ 'getContainer' ] ;
18
18
}
19
19
20
- const Drawer : React . FC < DrawerProps > = props => {
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
+ } ;
21
39
const {
22
40
open,
23
41
getContainer,
@@ -65,20 +83,6 @@ const Drawer: React.FC<DrawerProps> = props => {
65
83
) ;
66
84
} ;
67
85
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
-
82
86
if ( process . env . NODE_ENV !== 'production' ) {
83
87
Drawer . displayName = 'Drawer' ;
84
88
}
You can’t perform that action at this time.
0 commit comments