jacobworrel / react-windowed-select

An integration of react-window with react-select to efficiently render large lists.
MIT License
142 stars 38 forks source link

Async, Creatable, AsyncCreatable are unsupported #18

Closed ghost closed 4 years ago

ghost commented 4 years ago

At this time, I don't see how to make Async, Creatable, or AsyncCreatable Selects with this library.

It is possible to get some of this behavior using functions exported from react-select, e.g.

import {makeAsyncSelect} from 'react-select/async';
const Async = makeAsyncSelect(Select)

But this requires importing these functions directly from react-select rather than from react-windowed-select, and I am not sure if those components will work the same. The components exported from react-select are wrapped in a StateManager using manageState (for an example, see the last line of Creatable.js), but I cannot replicate this since the manageState function is not exported.

jacobworrel commented 4 years ago

@peterjcoffman - you could try importing just the windowed menu list component from react-windowed-select and then plugging that into react-select's Async, Createable or AsyncCreatable component via the components prop:

import { WindowedMenuList } from 'react-windowed-select;
import Creatable from 'react-select/creatable';

function App (props) {
  return (
    <CreatableSelect  components={{ MenuList: WindowedMenuList }} />
  );
};

Note: I haven't tested this so let me know if it works.

ghost commented 4 years ago

It turns out I don't need the Async or Creatable at this time, so I won't be needing this workaround.

jacobworrel commented 4 years ago

Ok closing for now.