Forms: Allow custom value creation in async select (#21759)

This commit is contained in:
Dominik Prokop 2020-01-28 08:38:21 +01:00 committed by GitHub
parent 1ad569c470
commit 6c32a4c0ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,8 @@ import { default as ReactSelect } from '@torkelo/react-select';
import Creatable from '@torkelo/react-select/creatable';
// @ts-ignore
import { default as ReactAsyncSelect } from '@torkelo/react-select/async';
// @ts-ignore
import { default as AsyncCreatable } from '@torkelo/react-select/async-creatable';
import { Icon } from '../../Icon/Icon';
import { css, cx } from 'emotion';
@ -243,7 +245,7 @@ export function SelectBase<T>({
// Instead of having AsyncSelect, as a separate component we render ReactAsyncSelect
if (loadOptions) {
ReactSelectComponent = ReactAsyncSelect;
ReactSelectComponent = allowCustomValue ? AsyncCreatable : ReactAsyncSelect;
asyncSelectProps = {
loadOptions,
defaultOptions,