diff --git a/src/Drawer.tsx b/src/Drawer.tsx index 7e00da5..e676158 100644 --- a/src/Drawer.tsx +++ b/src/Drawer.tsx @@ -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 => { - const props = { - ...defaultProps, - ...drawerProps, - }; +const Drawer: React.FC = props => { const { open, getContainer, @@ -83,6 +65,20 @@ const Drawer: React.FC = 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'; }