diff --git a/react-select/react-select-tests.tsx b/react-select/react-select-tests.tsx index de45b52d32..3b2ce8b429 100644 --- a/react-select/react-select-tests.tsx +++ b/react-select/react-select-tests.tsx @@ -5,7 +5,7 @@ import * as React from "react"; import * as ReactDOM from "react-dom"; -import { Option, ReactSelectProps, ReactAsyncSelectProps, MenuRendererProps } from "react-select-props"; +import { Option, ReactSelectProps, ReactAsyncSelectProps, ReactCreatableSelectProps, MenuRendererProps } from "react-select-props"; import Select = require("react-select"); const CustomOption = React.createClass({ @@ -104,7 +104,6 @@ class SelectTest extends React.Component, {}> { key: "1", options: options, optionRenderer: optionRenderer, - allowCreate: true, autofocus: true, autosize: true, clearable: true, @@ -200,3 +199,28 @@ class SelectAsyncTest extends React.Component, {}> { } } + +class SelectCreatableTest extends React.Component, {}> { + + render() { + const options: Option[] = [{ label: "Foo", value: "bar" }]; + const onChange = (value: any) => console.log(value); + + const creatableSelectProps: ReactCreatableSelectProps = { + name: "test-creatable-select", + value: "bar", + options: options, + onChange: onChange, + isOptionUnique: () => { return true; }, + isValidNewOption: () => { return true; }, + newOptionCreator: () => { return { label: "NewFoo", value: "newBar" }; }, + promptTextCreator: () => { return ""; }, + shouldKeyDownEventCreateNewOption: () => { return true; } + }; + + return
+ +
+ } + +} diff --git a/react-select/react-select.d.ts b/react-select/react-select.d.ts index f58cdafbdb..701d5efc4a 100644 --- a/react-select/react-select.d.ts +++ b/react-select/react-select.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-select v1.0.0 // Project: https://github.com/JedWatson/react-select -// Definitions by: ESQUIBET Hugo , Gilad Gray +// Definitions by: ESQUIBET Hugo , Gilad Gray , Izaak Baker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -68,12 +68,6 @@ declare namespace ReactSelect { * @default 'Add "{label}"?' */ addLabelText?: string; - /** - * allow new options to be created in multi mode (displays an "Add