diff --git a/src/pages/settings/Payments/PaymentMethodList.js b/src/pages/settings/Payments/PaymentMethodList.js index 546d8b5453f3..990f1e3f7c5b 100644 --- a/src/pages/settings/Payments/PaymentMethodList.js +++ b/src/pages/settings/Payments/PaymentMethodList.js @@ -22,9 +22,6 @@ import OfflineWithFeedback from '../../../components/OfflineWithFeedback'; import * as PaymentMethods from '../../../libs/actions/PaymentMethods'; import Log from '../../../libs/Log'; -const MENU_ITEM = 'menuItem'; -const BUTTON = 'button'; - const propTypes = { /** What to do when a menu item is pressed */ onPress: PropTypes.func.isRequired, @@ -123,7 +120,6 @@ class PaymentMethodList extends Component { combinedPaymentMethods = _.map(combinedPaymentMethods, paymentMethod => ({ ...paymentMethod, - type: MENU_ITEM, onPress: e => this.props.onPress(e, paymentMethod.accountType, paymentMethod.accountData, paymentMethod.isDefault), iconFill: this.isPaymentMethodActive(paymentMethod) ? StyleUtils.getIconFillColor(CONST.BUTTON_STATES.PRESSED) : null, wrapperStyle: this.isPaymentMethodActive(paymentMethod) ? [StyleUtils.getButtonBackgroundColorStyle(CONST.BUTTON_STATES.PRESSED)] : null, @@ -132,42 +128,6 @@ class PaymentMethodList extends Component { return combinedPaymentMethods; } - /** - * Take all of the different payment methods and create a list that can be easily digested by renderItem - * - * @returns {Array} - */ - createPaymentMethodList() { - const combinedPaymentMethods = this.getFilteredPaymentMethods(); - - // If we have not added any payment methods, show a default empty state - if (_.isEmpty(combinedPaymentMethods)) { - combinedPaymentMethods.push({ - key: 'addFirstPaymentMethodHelpText', - text: this.props.translate('paymentMethodList.addFirstPaymentMethod'), - }); - } - - if (!this.props.shouldShowAddPaymentMethodButton) { - return combinedPaymentMethods; - } - - combinedPaymentMethods.push({ - type: BUTTON, - text: this.props.translate('paymentMethodList.addPaymentMethod'), - icon: Expensicons.CreditCard, - style: [styles.buttonCTA], - iconStyles: [styles.buttonCTAIcon], - onPress: e => this.props.onPress(e), - isDisabled: this.props.isLoadingPayments, - shouldShowRightIcon: true, - success: true, - key: 'addPaymentMethodButton', - }); - - return combinedPaymentMethods; - } - /** * Dismisses the error on the payment method * @param {Object} item @@ -207,67 +167,79 @@ class PaymentMethodList extends Component { * @return {React.Component} */ renderItem({item}) { - if (item.type === MENU_ITEM) { - return ( - this.dismissError(item)} - pendingAction={item.pendingAction} - errors={item.errors} - errorRowStyles={styles.ph6} - > - - - ); - } - if (item.type === BUTTON) { - return ( - - {isOffline => ( -