Skip to content

Commit

Permalink
Merge pull request #30735 from ZhenjaHorbach/xof-currency-not-searcha…
Browse files Browse the repository at this point in the history
…ble-by-its-second-term

XOF currency not searchable by its second term
  • Loading branch information
amyevans authored Nov 3, 2023
2 parents 509d352 + 21b7746 commit 69227b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,7 @@ const CONST = {

TAX_ID: /^\d{9}$/,
NON_NUMERIC: /\D/g,
ANY_SPACE: /\s/g,

// Extract attachment's source from the data's html string
ATTACHMENT_DATA: /(data-expensify-source|data-name)="([^"]+)"/g,
Expand Down
8 changes: 6 additions & 2 deletions src/pages/iou/IOUCurrencySelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,12 @@ function IOUCurrencySelection(props) {
};
});

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

return {
Expand Down

0 comments on commit 69227b4

Please sign in to comment.