Skip to content

Commit

Permalink
Use helper method
Browse files Browse the repository at this point in the history
  • Loading branch information
iwiznia committed Jan 23, 2023
1 parent 90dcb3f commit 6370512
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 @@ -2,6 +2,7 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import Str from 'expensify-common/lib/str';
import ONYXKEYS from '../../ONYXKEYS';
import OptionsSelector from '../../components/OptionsSelector';
import Navigation from '../../libs/Navigation/Navigation';
Expand Down Expand Up @@ -88,7 +89,7 @@ class IOUCurrencySelection extends Component {
*/
changeSearchValue(searchValue) {
const currencyOptions = this.getCurrencyOptions(this.props.currencyList);
const searchRegex = new RegExp(searchValue.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'i');
const searchRegex = Str.escapeForRegExp(searchValue);
const filteredCurrencies = _.filter(currencyOptions, currencyOption => searchRegex.test(currencyOption.text));

this.setState({
Expand Down

0 comments on commit 6370512

Please sign in to comment.