summaryrefslogtreecommitdiff
path: root/src/core/components/elements/Select/HookFormSelect.jsx
blob: 45cd89b6f2cf90ac75ad706d2f8b002743158dab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import ReactSelect from "react-select"

const HookFormSelect = ({
  field,
  ...props
}) => (
  <ReactSelect
    classNamePrefix="form-select"
    ref={field.ref}
    onChange={(option) => field.onChange(option.value)}
    value={field.value ? props.options.find(option => option.value === field.value) : ''}
    isDisabled={props.disabled}
    {...props}
  />
)

export default HookFormSelect