diff --git a/components/tree-select/index.tsx b/components/tree-select/index.tsx index 3223201420..001aa8e996 100644 --- a/components/tree-select/index.tsx +++ b/components/tree-select/index.tsx @@ -222,7 +222,7 @@ const InternalTreeSelect = - renderSwitcherIcon(treePrefixCls, switcherIcon, treeLine, nodeProps) + renderSwitcherIcon(treePrefixCls, switcherIcon, nodeProps, treeLine) } showTreeIcon={treeIcon as any} notFoundContent={mergedNotFound} diff --git a/components/tree/Tree.tsx b/components/tree/Tree.tsx index 852291154d..51e4db82b9 100644 --- a/components/tree/Tree.tsx +++ b/components/tree/Tree.tsx @@ -239,7 +239,7 @@ const Tree = React.forwardRef((props, ref) => { checkable={checkable ? : checkable} selectable={selectable} switcherIcon={(nodeProps: AntTreeNodeProps) => - renderSwitcherIcon(prefixCls, switcherIcon, showLine, nodeProps) + renderSwitcherIcon(prefixCls, switcherIcon, nodeProps, showLine) } draggable={draggableConfig} > diff --git a/components/tree/__tests__/util.test.tsx b/components/tree/__tests__/util.test.tsx index 77642df7d8..7ef6180c6f 100644 --- a/components/tree/__tests__/util.test.tsx +++ b/components/tree/__tests__/util.test.tsx @@ -51,7 +51,7 @@ describe('Tree util', () => { it('returns a loading icon when loading', () => { const { container } = render( - <>{renderSwitcherIcon(prefixCls, undefined, true, { loading: true })}, + <>{renderSwitcherIcon(prefixCls, undefined, { loading: true }, true)}, ); expect(container.getElementsByClassName(`${prefixCls}-switcher-loading-icon`)).toHaveLength( 1, @@ -60,7 +60,7 @@ describe('Tree util', () => { it('returns nothing when node is a leaf without showLine', () => { const { container } = render( - <>{renderSwitcherIcon(prefixCls, undefined, false, { loading: false, isLeaf: true })}, + <>{renderSwitcherIcon(prefixCls, undefined, { loading: false, isLeaf: true }, false)}, ); expect(container).toBeEmptyDOMElement(); }); @@ -73,8 +73,8 @@ describe('Tree util', () => { {renderSwitcherIcon( prefixCls, undefined, - { showLeafIcon: customLeafIcon }, { loading: false, isLeaf: true }, + { showLeafIcon: customLeafIcon }, )} , ); @@ -94,8 +94,8 @@ describe('Tree util', () => { {renderSwitcherIcon( prefixCls, undefined, - { showLeafIcon }, { loading: false, isLeaf: true }, + { showLeafIcon }, )} , ); diff --git a/components/tree/utils/iconUtil.tsx b/components/tree/utils/iconUtil.tsx index e275d335f4..aa34de5498 100644 --- a/components/tree/utils/iconUtil.tsx +++ b/components/tree/utils/iconUtil.tsx @@ -11,8 +11,8 @@ import type { AntTreeNodeProps, TreeLeafIcon, SwitcherIcon } from '../Tree'; export default function renderSwitcherIcon( prefixCls: string, switcherIcon: SwitcherIcon, - showLine: boolean | { showLeafIcon: boolean | TreeLeafIcon } | undefined, treeNodeProps: AntTreeNodeProps, + showLine?: boolean | { showLeafIcon: boolean | TreeLeafIcon }, ): React.ReactNode { const { isLeaf, expanded, loading } = treeNodeProps;