From 0e52f9a891bfee6f8d6fed05677826879ac9fa80 Mon Sep 17 00:00:00 2001 From: MrHeer Date: Mon, 16 Sep 2019 19:08:46 +0800 Subject: [PATCH] :bug: fix Tree switcherIcon prop not working when showLine close #18810 --- components/tree/Tree.tsx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/components/tree/Tree.tsx b/components/tree/Tree.tsx index 8e530860eb..3703d4cb78 100644 --- a/components/tree/Tree.tsx +++ b/components/tree/Tree.tsx @@ -194,10 +194,20 @@ export default class Tree extends React.Component { if (loading) { return ; } - if (showLine) { - if (isLeaf) { + if (isLeaf) { + if (showLine) { return ; } + 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 ( { /> ); } - const switcherCls = `${prefixCls}-switcher-icon`; - if (isLeaf) { - return null; - } - if (switcherIcon) { - const switcherOriginCls = switcherIcon.props.className || ''; - return React.cloneElement(switcherIcon, { - className: classNames(switcherOriginCls, switcherCls), - }); - } return ; };