import * as React from "react"; import { withStyle } from "baseui"; import { Option, Select, StyledDropdownListItem, Value } from "baseui/select"; import { StyledList, StyledEmptyState, OptionListProps } from "baseui/menu"; import { FixedSizeList } from "react-window"; const LIST_ITEM_HEIGHT = 36; const EMPTY_LIST_HEIGHT = 72; const MAX_LIST_HEIGHT = 500; const ListItem = withStyle(StyledDropdownListItem, { paddingTop: 0, paddingBottom: 0, display: "flex", alignItems: "center", }); const FixedSizeListItem = ({ data, index, style, }: { data: { props: OptionListProps }[]; index: number; style: React.CSSProperties; }) => { const { item, overrides, ...restChildProps } = data[index].props; return ( {item.id} ); }; const VirtualDropdown = React.forwardRef( (props: any, ref) => { const children = React.Children.toArray(props.children); if (!children[0] || !children[0].props.item) { return ( ); } const height = Math.min( MAX_LIST_HEIGHT, children.length * LIST_ITEM_HEIGHT, ); return ( data[index].props.item.id } itemSize={LIST_ITEM_HEIGHT} > {FixedSizeListItem} ); }, ); const options: Option[] = []; for (let i = 0; i < 10000; i += 1) { options.push({ id: i, label: "" + i, }); } export default function Example() { const [value, setValue] = React.useState([]); return (