From 3c559031623649a67825ff47f34512f0eb946861 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Wed, 22 Feb 2023 10:14:32 +0700
Subject: fix

---
 src/core/components/elements/Select/HookFormSelect.jsx | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 src/core/components/elements/Select/HookFormSelect.jsx

(limited to 'src/core/components/elements/Select/HookFormSelect.jsx')

diff --git a/src/core/components/elements/Select/HookFormSelect.jsx b/src/core/components/elements/Select/HookFormSelect.jsx
new file mode 100644
index 00000000..45cd89b6
--- /dev/null
+++ b/src/core/components/elements/Select/HookFormSelect.jsx
@@ -0,0 +1,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
\ No newline at end of file
-- 
cgit v1.2.3

