Skip to content

Commit

Permalink
🐛 fix Tree switcherIcon prop not working when showLine
Browse files Browse the repository at this point in the history
close #18810
  • Loading branch information
MrHeer committed Sep 16, 2019
1 parent 9ea143b commit 7b38632
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions components/tree/Tree.tsx
Expand Up @@ -194,28 +194,28 @@ export default class Tree extends React.Component<TreeProps, any> {
if (loading) {
return <Icon type="loading" className={`${prefixCls}-switcher-loading-icon`} />;
}
if (showLine) {
if (isLeaf) {
if (isLeaf) {
if (showLine) {
return <Icon type="file" className={`${prefixCls}-switcher-line-icon`} />;
}
return (
<Icon
type={expanded ? 'minus-square' : 'plus-square'}
className={`${prefixCls}-switcher-line-icon`}
theme="outlined"
/>
);
}
const switcherCls = `${prefixCls}-switcher-icon`;
if (isLeaf) {
return null;
}
const switcherCls = `${prefixCls}-switcher-icon`;
if (switcherIcon) {
const switcherOriginCls = switcherIcon.props.className || '';
return React.cloneElement(switcherIcon, {
className: classNames(switcherOriginCls, switcherCls),
});
}
if (showLine) {
return (
<Icon
type={expanded ? 'minus-square' : 'plus-square'}
className={`${prefixCls}-switcher-line-icon`}
theme="outlined"
/>
);
}
return <Icon type="caret-down" className={switcherCls} theme="filled" />;
};

Expand Down

0 comments on commit 7b38632

Please sign in to comment.