From f394390b98b6e5c64d3a8e047ba9aed70af9fb13 Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Sat, 10 Apr 2021 13:04:12 +0200 Subject: [PATCH] fix(currencyList): add filter currency code. --- .../CurrencyFormDialog/CurrencyFormFields.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/client/src/containers/Dialogs/CurrencyFormDialog/CurrencyFormFields.js b/client/src/containers/Dialogs/CurrencyFormDialog/CurrencyFormFields.js index beb88ef24..56ecb2276 100644 --- a/client/src/containers/Dialogs/CurrencyFormDialog/CurrencyFormFields.js +++ b/client/src/containers/Dialogs/CurrencyFormDialog/CurrencyFormFields.js @@ -19,6 +19,17 @@ export default function CurrencyFormFields() { const { isEditMode } = useCurrencyFormContext(); + // Filter currency code + const filterCurrencyCode = (query, currency, _index, exactMatch) => { + const normalizedTitle = currency.name.toLowerCase(); + const normalizedQuery = query.toLowerCase(); + if (exactMatch) { + return normalizedTitle === normalizedQuery; + } else { + return normalizedTitle.indexOf(normalizedQuery) >= 0; + } + }; + return (
@@ -27,7 +38,10 @@ export default function CurrencyFormFields() { field: { value }, meta: { error, touched }, }) => ( - +