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,17 +1,14 @@
import { Select, Row, Col, Tag } from "antd";
import React, { useEffect, useState } from "react";
import React, { useEffect, useState, forwardRef } from "react";
import { useTranslation } from "react-i18next";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
//To be used as a form element only.
const { Option } = Select;
const InvoiceLineSearchSelect = ({
value,
onChange,
options,
onBlur,
onSelect,
}) => {
const InvoiceLineSearchSelect = (
{ value, onChange, options, onBlur, onSelect },
ref
) => {
const [option, setOption] = useState(value);
const { t } = useTranslation();
@@ -23,6 +20,7 @@ const InvoiceLineSearchSelect = ({
return (
<Select
ref={ref}
showSearch
autoFocus
value={option}
@@ -62,4 +60,4 @@ const InvoiceLineSearchSelect = ({
</Select>
);
};
export default InvoiceLineSearchSelect;
export default forwardRef(InvoiceLineSearchSelect);