`ListBox` doesn't properly restore the search box input
- 主要语言
- JavaScript
- 星标
- 6
- 派生
- 0
- 平均合并
- 21 小时 41 分钟
- 30 天内合并 PR
- 1
描述
When using the `showSearch` and `searchLimit` properties, the search input will clear itself despite the filter still being applied.
1. Create a `ListBox` with `showSearch={true}` and `searchLimit={10}`, and with more than 10 options.
2. Input some filter text into the search area.
3. Filter the options externally so that there are fewer than 10 options, and the search area is hidden.
4. Undo the filter to restore the search area.
5. The search filter is still applied, but the search input is blank.
```jsx
const options = ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten']
const MyComponent = (): JSX.Element => {
const [filter, setFilter] = useState(false)
const toggleFilter = (): void => { setFilter(!filter) }
return (
]}
items={options
.filter((_, index) => !filter || index < 3)
.map(option => ({ name: option, value: option }))}
onChange={() => {}}
/>
)
}
```
贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。