Skip to content

Commit 6e2c7f8

Browse files
author
刘欢
committed
feat: set autoClearSearchValue default value
1 parent 805908b commit 6e2c7f8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Select.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,11 @@ const Select = React.forwardRef<BaseSelectRef, SelectProps<any, DefaultOptionTyp
234234
];
235235
const legacyShowSearch: SearchConfig<DefaultOptionType> = {};
236236
legacySearchProps.forEach((propsName) => {
237-
legacyShowSearch[propsName] = restProps?.[propsName];
237+
if (propsName === 'autoClearSearchValue') {
238+
legacyShowSearch[propsName] = props?.[propsName] ?? true;
239+
return;
240+
}
241+
legacyShowSearch[propsName] = props?.[propsName];
238242
});
239243
const mergedShowSearch = typeof showSearch === 'object' ? showSearch : legacyShowSearch;
240244
const {
@@ -244,7 +248,7 @@ const Select = React.forwardRef<BaseSelectRef, SelectProps<any, DefaultOptionTyp
244248
optionLabelProp,
245249
filterSort,
246250
onSearch,
247-
autoClearSearchValue,
251+
autoClearSearchValue = true,
248252
tokenSeparators,
249253
} = mergedShowSearch;
250254

0 commit comments

Comments
 (0)