MCPcopy Create free account
hub / github.com/adobe/react-spectrum / AsyncComboBox

Function AsyncComboBox

packages/react-aria-components/test/ComboBox.test.js:1173–1196  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1171 }
1172
1173 function AsyncComboBox() {
1174 let list = useAsyncList({
1175 getKey: item => item.id,
1176 async load({filterText}) {
1177 let rows = itemsForFilterText(filterText);
1178 await new Promise(resolve => setTimeout(resolve, ASYNC_DELAY_MS));
1179 return {items: rows};
1180 }
1181 });
1182
1183 return (
1184 <ComboBox
1185 items={list.items}
1186 inputValue={list.filterText}
1187 onInputChange={list.setFilterText}>
1188 <Label>SW Characters</Label>
1189 <Input />
1190 <Button>{'<'}</Button>
1191 <Popover>
1192 <ListBox>{item => <ListBoxItem id={item.id}>{item.name}</ListBoxItem>}</ListBox>
1193 </Popover>
1194 </ComboBox>
1195 );
1196 }
1197
1198 let {container, queryByRole} = render(<AsyncComboBox />);
1199 let comboboxTester = testUtilUser.createTester('ComboBox', {root: container});

Callers

nothing calls this directly

Calls 1

useAsyncListFunction · 0.90

Tested by

no test coverage detected