Browse Source

fix: When the searchRender of the Tree is false, remove the excess padding at the top (#2386)

YyumeiZhang 1 year ago
parent
commit
25d6d76c6e
1 changed files with 3 additions and 3 deletions
  1. 3 3
      packages/semi-ui/tree/index.tsx

+ 3 - 3
packages/semi-ui/tree/index.tsx

@@ -540,6 +540,9 @@ class Tree extends BaseComponent<TreeProps, TreeState> {
             searchPlaceholder,
             showClear
         } = this.props;
+        if (searchRender === false) {
+            return null;
+        }
         const inputcls = cls(`${prefixcls}-input`);
         const { inputValue } = this.state;
         const inputProps = {
@@ -559,9 +562,6 @@ class Tree extends BaseComponent<TreeProps, TreeState> {
                         if (isFunction(searchRender)) {
                             return searchRender({ ...inputProps });
                         }
-                        if (searchRender === false) {
-                            return null;
-                        }
                         return (
                             <Input
                                 aria-label='Filter Tree'