Browse Source
refactor: remove defaultProps from <Collapse /> and move logic to destruction, as rest of props for single source of truth (#27963)
pull/27992/head
Eugene Matvejev
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
5 deletions
-
components/collapse/Collapse.tsx
|
|
@ -43,7 +43,7 @@ interface CollapseInterface extends React.FC<CollapseProps> { |
|
|
|
|
|
|
|
const Collapse: CollapseInterface = props => { |
|
|
|
const { getPrefixCls, direction } = React.useContext(ConfigContext); |
|
|
|
const { prefixCls: customizePrefixCls, className = '', bordered, ghost } = props; |
|
|
|
const { prefixCls: customizePrefixCls, className = '', bordered = true, ghost } = props; |
|
|
|
const prefixCls = getPrefixCls('collapse', customizePrefixCls); |
|
|
|
|
|
|
|
const getIconPosition = () => { |
|
|
@ -83,6 +83,7 @@ const Collapse: CollapseInterface = props => { |
|
|
|
<RcCollapse |
|
|
|
openAnimation={openAnimation} |
|
|
|
{...props} |
|
|
|
bordered={bordered} |
|
|
|
expandIcon={(panelProps: PanelProps) => renderExpandIcon(panelProps)} |
|
|
|
prefixCls={prefixCls} |
|
|
|
className={collapseClassName} |
|
|
@ -92,8 +93,4 @@ const Collapse: CollapseInterface = props => { |
|
|
|
|
|
|
|
Collapse.Panel = CollapsePanel; |
|
|
|
|
|
|
|
Collapse.defaultProps = { |
|
|
|
bordered: true, |
|
|
|
}; |
|
|
|
|
|
|
|
export default Collapse; |
|
|
|