Skip to content

Commit

Permalink
Change usage of boolean prop name
Browse files Browse the repository at this point in the history
  • Loading branch information
phivh committed Feb 8, 2022
1 parent 9de73c1 commit 2298ebc
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
5 changes: 2 additions & 3 deletions src/components/KYCWall/BaseKYCWall.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class KYCWall extends React.Component {
}

componentWillUnmount() {
if (this.props.listenResize) {
if (this.props.shouldListenForResize) {
window.removeEventListener('resize', null);
}
PaymentMethods.kycWallRef.current = null;
Expand Down Expand Up @@ -63,7 +63,6 @@ class KYCWall extends React.Component {
*
* @param {Object} position
*/

setPositionAddPaymentMenu(position) {
this.setState({
anchorPositionTop: position.anchorPositionTop,
Expand All @@ -84,7 +83,7 @@ class KYCWall extends React.Component {
Log.info('[KYC Wallet] User does not have valid payment method');
let clickedElementLocation = getClickedElementLocation(event.nativeEvent);
let position = this.getAnchorPosition(clickedElementLocation);
if (this.props.listenResize) {
if (this.props.shouldListenForResize) {
window.addEventListener('resize', () => {
clickedElementLocation = getClickedElementLocation(event.nativeEvent);
position = this.getAnchorPosition(clickedElementLocation);
Expand Down
2 changes: 1 addition & 1 deletion src/components/KYCWall/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import BaseKYCWall from './BaseKYCWall';

const KYCWall = props => (
// eslint-disable-next-line react/jsx-props-no-spreading
<BaseKYCWall {...props} listenResize />
<BaseKYCWall {...props} shouldListenForResize />
);

KYCWall.propTypes = propTypes;
Expand Down
4 changes: 2 additions & 2 deletions src/components/KYCWall/kycWallPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const propTypes = {
popoverPlacement: PropTypes.string,

/** Listen for window resize event on web and desktop */
listenResize: PropTypes.bool,
shouldListenForResize: PropTypes.bool,

...userWalletPropTypes,
};
Expand All @@ -24,7 +24,7 @@ const defaultProps = {
// eslint-disable-next-line react/default-props-match-prop-types
userWallet: {},
popoverPlacement: 'top',
listenResize: false,
shouldListenForResize: false,
};

export {propTypes, defaultProps};
6 changes: 3 additions & 3 deletions src/pages/settings/Payments/PaymentsPage/BasePaymentsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class BasePaymentsPage extends React.Component {
*/
paymentMethodPressed(nativeEvent, accountType, account) {
let position = getClickedElementLocation(nativeEvent);
if (this.props.listenResize) {
if (this.props.shouldListenForResize) {
window.addEventListener('resize', () => {
position = getClickedElementLocation(nativeEvent);
this.setPositionAddPaymentMenu(position);
Expand Down Expand Up @@ -168,7 +168,7 @@ class BasePaymentsPage extends React.Component {
* Hide the add payment modal
*/
hideAddPaymentMenu() {
if (this.props.listenResize) {
if (this.props.shouldListenForResize) {
window.removeEventListener('resize', null);
}
this.setState({shouldShowAddPaymentMenu: false});
Expand All @@ -178,7 +178,7 @@ class BasePaymentsPage extends React.Component {
* Hide the default / delete modal
*/
hideDefaultDeleteMenu() {
if (this.props.listenResize) {
if (this.props.shouldListenForResize) {
window.removeEventListener('resize', null);
}
this.setState({shouldShowDefaultDeleteMenu: false});
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/Payments/PaymentsPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import BasePaymentsPage from './BasePaymentsPage';

const PaymentsPage = () => (
<BasePaymentsPage listenResize />
<BasePaymentsPage shouldListenForResize />
);

PaymentsPage.displayName = 'PaymentsPage';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const propTypes = {
isLoadingPaymentMethods: PropTypes.bool,

/** Listen for window resize event on web and desktop. */
listenResize: PropTypes.bool,
shouldListenForResize: PropTypes.bool,

...withLocalizePropTypes,

Expand All @@ -27,7 +27,7 @@ const defaultProps = {
},
betas: [],
isLoadingPaymentMethods: true,
listenResize: false,
shouldListenForResize: false,
};

export {propTypes, defaultProps};

0 comments on commit 2298ebc

Please sign in to comment.