Skip to content

Commit

Permalink
Merge pull request #27946 from huzaifa-99/26120-feat-allow-currency-s…
Browse files Browse the repository at this point in the history
…earch-by-name

Allow currency search by currency name
  • Loading branch information
yuwenmemon authored Sep 22, 2023
2 parents ef60a95 + b123a76 commit 0851888
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pages/iou/IOUCurrencySelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ function IOUCurrencySelection(props) {
const currencyOptions = _.map(currencyList, (currencyInfo, currencyCode) => {
const isSelectedCurrency = currencyCode === selectedCurrencyCode;
return {
currencyName: currencyInfo.name,
text: `${currencyCode} - ${CurrencyUtils.getLocalizedCurrencySymbol(currencyCode)}`,
currencyCode,
keyForList: currencyCode,
Expand All @@ -105,7 +106,7 @@ function IOUCurrencySelection(props) {
});

const searchRegex = new RegExp(Str.escapeForRegExp(searchValue.trim()), 'i');
const filteredCurrencies = _.filter(currencyOptions, (currencyOption) => searchRegex.test(currencyOption.text));
const filteredCurrencies = _.filter(currencyOptions, (currencyOption) => searchRegex.test(currencyOption.text) || searchRegex.test(currencyOption.currencyName));
const isEmpty = searchValue.trim() && !filteredCurrencies.length;

return {
Expand Down

0 comments on commit 0851888

Please sign in to comment.