Fixed forward reference issue caused by new Antd version.

This commit is contained in:
Patrick Fic
2020-07-15 11:12:30 -07:00
parent 09990b1642
commit bdd1f53ff9
3 changed files with 23 additions and 31 deletions

View File

@@ -1,16 +1,13 @@
import { Select, Tag } from "antd";
import React, { useEffect, useState } from "react";
import React, { useEffect, useState, forwardRef } from "react";
const { Option } = Select;
//To be used as a form element only.
const VendorSearchSelect = ({
value,
onChange,
options,
onSelect,
disabled,
}) => {
const VendorSearchSelect = (
{ value, onChange, options, onSelect, disabled },
ref
) => {
const [option, setOption] = useState(value);
useEffect(() => {
@@ -21,6 +18,7 @@ const VendorSearchSelect = ({
return (
<Select
ref={ref}
showSearch
value={option}
style={{
@@ -43,4 +41,4 @@ const VendorSearchSelect = ({
</Select>
);
};
export default VendorSearchSelect;
export default forwardRef(VendorSearchSelect);