Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -778,23 +778,6 @@ function getHeaderMessage(hasSelectableOptions, hasUserToInvite, searchValue, ma
return '';
}

/**
* Returns the currency list for sections display
*
* @param {Object} currencyOptions
* @param {String} searchValue
* @returns {Array}
*/
function getCurrencyListForSections(currencyOptions, searchValue) {
const filteredOptions = _.filter(currencyOptions, currencyOption => (
isSearchStringMatch(searchValue, currencyOption.text)));

return {
// returns filtered options i.e. options with string match if search text is entered
currencyOptions: filteredOptions,
};
}

export {
addSMSDomainIfPhoneNumber,
isCurrentUser,
Expand All @@ -803,7 +786,6 @@ export {
getMemberInviteOptions,
getHeaderMessage,
getPersonalDetailsForLogins,
getCurrencyListForSections,
getIOUConfirmationOptionsFromMyPersonalDetail,
getIOUConfirmationOptionsFromParticipants,
getSearchText,
Expand Down
15 changes: 6 additions & 9 deletions src/pages/iou/IOUCurrencySelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import ONYXKEYS from '../../ONYXKEYS';
import * as OptionsListUtils from '../../libs/OptionsListUtils';
import OptionsSelector from '../../components/OptionsSelector';
import Navigation from '../../libs/Navigation/Navigation';
import ScreenWrapper from '../../components/ScreenWrapper';
Expand Down Expand Up @@ -41,11 +40,9 @@ class IOUCurrencySelection extends Component {
constructor(props) {
super(props);

const {currencyOptions} = OptionsListUtils.getCurrencyListForSections(this.getCurrencyOptions(this.props.currencyList), '');

this.state = {
searchValue: '',
currencyData: currencyOptions,
currencyData: this.getCurrencyOptions(this.props.currencyList),
};
this.getCurrencyOptions = this.getCurrencyOptions.bind(this);
this.getSections = this.getSections.bind(this);
Expand Down Expand Up @@ -90,13 +87,13 @@ class IOUCurrencySelection extends Component {
* @return {void}
*/
changeSearchValue(searchValue) {
const {currencyOptions} = OptionsListUtils.getCurrencyListForSections(
this.getCurrencyOptions(this.props.currencyList),
searchValue,
);
const currencyOptions = this.getCurrencyOptions(this.props.currencyList);
const searchRegex = new RegExp(searchValue, 'i');
const filteredCurrencies = _.filter(currencyOptions, currencyOption => searchRegex.test(currencyOption.text));

this.setState({
searchValue,
currencyData: currencyOptions,
currencyData: filteredCurrencies,
});
}

Expand Down