Merge pull request #19439 from onatm/react-select/add-onNewOptionClick

[react-select] add onNewOptionClick prop to ReactCreatableSelectProps
This commit is contained in:
Mine Starks 2017-08-29 16:34:37 -07:00 committed by GitHub
commit 494b17ab8a

View File

@ -7,6 +7,7 @@
// Mark Vujevits <https://github.com/vujevits>
// Mike Deverell <https://github.com/devrelm>
// MartynasZilinskas <https://github.com/MartynasZilinskas>
// Onat Yigit Mercan <https://github.com/onatm>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@ -49,6 +50,7 @@ declare namespace ReactSelectClass {
type OnChangeSingleHandler<TValue = OptionValues> = OnChangeHandler<Option<TValue>>;
type OnChangeMultipleHandler<TValue = OptionValues> = OnChangeHandler<Options<TValue>>;
type OnChangeHandler<TOption = Option | Options> = (newValue: TOption | null) => void;
type OnNewOptionClickHandler = (option: Option) => void;
type LoadOptionsHandler = LoadOptionsAsyncHandler | LoadOptionsLegacyHandler;
type LoadOptionsAsyncHandler = (input: string) => Promise<AutocompleteResult>;
@ -453,6 +455,11 @@ declare namespace ReactSelectClass {
* Decides if a keyDown event (eg its 'keyCode') should result in the creation of a new option.
*/
shouldKeyDownEventCreateNewOption?: ShouldKeyDownEventCreateNewOptionHandler;
/**
* new option click handler: function (option) {}
*/
onNewOptionClick?: OnNewOptionClickHandler;
}
interface ReactAsyncSelectProps extends ReactSelectProps {