简体   繁体   中英

antd: 'inputValue' prop of Select component is not working

I'm using antd 's ( v3.23.1 ) Select component with mode="multiple" . After typing in Select search field and clicking outside, clears the searched text from the input. So I'm trying to make controlled component by persisting the search text in state variable(inside onSearch method) and passing it to inputValue prop of Select component(as given in the document ), but it is not working, state variable holds proper value but however search text in input gets cleared. Actually inputValue prop is not working at all I guess, because even if I pass '' to inputValue prop, it works as an uncontrolled component. I tried setting autoClearSearchValue to false - but this persists search value only after selecting or deselecting option not on click outside

This issue can be reproducible here .

So, is any other way I can persist search text even after clicking outside?

It's by design and there is no plan in changing such behavior.

You can render another Input component and persist the search value with the Select component.

You can check this issue on antd GitHub.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM