feat: crypto dropdown should stay open when editing commissions

This commit is contained in:
Sérgio Salgado 2021-03-16 13:28:38 +00:00 committed by Josh Harvey
parent bee2dc42e6
commit 7af8079a2a
3 changed files with 8 additions and 2 deletions

View file

@ -14,6 +14,7 @@ const Autocomplete = ({
multiple,
onChange,
labelProp,
shouldStayOpen,
value: outsideValue,
error,
fullWidth,

View file

@ -21,6 +21,7 @@ const AutocompleteFormik = ({ options, onChange, ...props }) => {
}
const onChangeHandler = value => setFieldValue(name, value)
const shouldStayOpen = !!props.shouldStayOpen
return (
<Autocomplete
@ -38,7 +39,10 @@ const AutocompleteFormik = ({ options, onChange, ...props }) => {
if (!props.multiple) return setOpen(true)
setOpen(value?.length !== props.limit)
}}
onClose={() => setOpen(false)}
onClose={(event, reason) => {
if (shouldStayOpen && reason !== 'blur') setOpen(true)
else setOpen(false)
}}
{...props}
/>
)

View file

@ -103,7 +103,8 @@ const getOverridesFields = (getData, currency, auxElements) => {
valueProp: 'code',
labelProp: 'display',
multiple: true,
onChange: onCryptoChange
onChange: onCryptoChange,
shouldStayOpen: true
}
},
{