diff --git a/react-select/index.d.ts b/react-select/index.d.ts index 102eaa4741..336eb5460b 100644 --- a/react-select/index.d.ts +++ b/react-select/index.d.ts @@ -444,4 +444,5 @@ declare class ReactSelectClass extends React.Component { } class Async extends React.Component { } + class AsyncCreatable extends React.Component { } } diff --git a/react-select/react-select-tests.tsx b/react-select/react-select-tests.tsx index eb0dde3061..d2704878d9 100644 --- a/react-select/react-select-tests.tsx +++ b/react-select/react-select-tests.tsx @@ -223,3 +223,49 @@ class SelectCreatableTest extends React.Component, {}> { } } + +class SelectAsyncCreatableTest extends React.Component, {}> { + + render() { + const getOptions = (input: string, callback: Function) => { + setTimeout(function() { + callback(null, options); + }, 500); + }; + const options: Option[] = [{ label: "Foo", value: "bar" }]; + const onChange = (value: any) => console.log(value); + + const asyncCreatableSelectProps: ReactCreatableSelectProps & ReactAsyncSelectProps = { + name: "test-select-async-creatable", + className: "test-select-async-creatable", + key: "1", + matchPos: "any", + matchProp: "any", + multi: true, + onValueClick: onChange, + valueKey: "github", + labelKey: "name", + onChange: onChange, + simpleValue: undefined, + value: options, + loadOptions: getOptions, + cache: {}, + ignoreAccents: false, + ignoreCase: true, + isLoading: false, + minimumInput: 5, + searchPromptText: "search...", + searchingText: "searching...", + isOptionUnique: () => { return true; }, + isValidNewOption: () => { return true; }, + newOptionCreator: () => { return { label: "NewFoo", value: "newBar" }; }, + promptTextCreator: () => { return ""; }, + shouldKeyDownEventCreateNewOption: () => { return true; } + }; + + return
+ +
+ } + +}