Commit 6c32a4c0 by Dominik Prokop Committed by GitHub

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

parent 1ad569c4
...@@ -6,6 +6,8 @@ import { default as ReactSelect } from '@torkelo/react-select'; ...@@ -6,6 +6,8 @@ import { default as ReactSelect } from '@torkelo/react-select';
import Creatable from '@torkelo/react-select/creatable'; import Creatable from '@torkelo/react-select/creatable';
// @ts-ignore // @ts-ignore
import { default as ReactAsyncSelect } from '@torkelo/react-select/async'; 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 { Icon } from '../../Icon/Icon';
import { css, cx } from 'emotion'; import { css, cx } from 'emotion';
...@@ -243,7 +245,7 @@ export function SelectBase<T>({ ...@@ -243,7 +245,7 @@ export function SelectBase<T>({
// Instead of having AsyncSelect, as a separate component we render ReactAsyncSelect // Instead of having AsyncSelect, as a separate component we render ReactAsyncSelect
if (loadOptions) { if (loadOptions) {
ReactSelectComponent = ReactAsyncSelect; ReactSelectComponent = allowCustomValue ? AsyncCreatable : ReactAsyncSelect;
asyncSelectProps = { asyncSelectProps = {
loadOptions, loadOptions,
defaultOptions, defaultOptions,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment