Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Payment Method fill when menu is active #5981

Merged
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
10 changes: 9 additions & 1 deletion src/pages/settings/Payments/PaymentMethodList.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
import {FlatList, Text} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import lodashGet from 'lodash/get';
import styles from '../../../styles/styles';
import styles, {getButtonBackgroundColorStyle, getIconFillColor} from '../../../styles/styles';
import MenuItem from '../../../components/MenuItem';
import compose from '../../../libs/compose';
import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize';
Expand All @@ -26,6 +26,9 @@ const propTypes = {
/** Are we loading payments from the server? */
isLoadingPayments: PropTypes.bool,

/** Is the payment options menu open / active? */
isAddPaymentMenuActive: PropTypes.bool,

/** User's paypal.me username if they have one */
payPalMeUsername: PropTypes.string,

Expand All @@ -52,6 +55,7 @@ const defaultProps = {
bankAccountList: [],
cardList: [],
isLoadingPayments: false,
isAddPaymentMenuActive: false,
};

class PaymentMethodList extends Component {
Expand Down Expand Up @@ -134,6 +138,8 @@ class PaymentMethodList extends Component {
onPress: e => this.props.onPress(e),
key: 'addPaymentMethodButton',
disabled: this.props.isLoadingPayments,
iconFill: this.props.isAddPaymentMenuActive ? getIconFillColor(CONST.BUTTON_STATES.PRESSED) : null,
wrapperStyle: this.props.isAddPaymentMenuActive ? [getButtonBackgroundColorStyle(CONST.BUTTON_STATES.PRESSED)] : [],
});

return combinedPaymentMethods;
Expand All @@ -157,8 +163,10 @@ class PaymentMethodList extends Component {
icon={item.icon}
key={item.key}
disabled={item.disabled}
iconFill={item.iconFill}
iconHeight={item.iconSize}
iconWidth={item.iconSize}
wrapperStyle={item.wrapperStyle}
/>
);
}
Expand Down
1 change: 1 addition & 0 deletions src/pages/settings/Payments/PaymentsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class PaymentsPage extends React.Component {
onPress={this.paymentMethodPressed}
style={[styles.flex4]}
isLoadingPayments={this.props.isLoadingPaymentMethods}
isAddPaymentMenuActive={this.state.shouldShowAddPaymentMenu}
/>
</ScrollView>
<Popover
Expand Down