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
parent
commit
41a6c655bf
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      components/collapse/Collapse.tsx

7
components/collapse/Collapse.tsx

@ -43,7 +43,7 @@ interface CollapseInterface extends React.FC<CollapseProps> {
const Collapse: CollapseInterface = props => { const Collapse: CollapseInterface = props => {
const { getPrefixCls, direction } = React.useContext(ConfigContext); 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 prefixCls = getPrefixCls('collapse', customizePrefixCls);
const getIconPosition = () => { const getIconPosition = () => {
@ -83,6 +83,7 @@ const Collapse: CollapseInterface = props => {
<RcCollapse <RcCollapse
openAnimation={openAnimation} openAnimation={openAnimation}
{...props} {...props}
bordered={bordered}
expandIcon={(panelProps: PanelProps) => renderExpandIcon(panelProps)} expandIcon={(panelProps: PanelProps) => renderExpandIcon(panelProps)}
prefixCls={prefixCls} prefixCls={prefixCls}
className={collapseClassName} className={collapseClassName}
@ -92,8 +93,4 @@ const Collapse: CollapseInterface = props => {
Collapse.Panel = CollapsePanel; Collapse.Panel = CollapsePanel;
Collapse.defaultProps = {
bordered: true,
};
export default Collapse; export default Collapse;

Loading…
Cancel
Save