From 2298ebc829e69a576a1e5057e25864e12285d172 Mon Sep 17 00:00:00 2001 From: phivh Date: Tue, 8 Feb 2022 13:59:34 +0700 Subject: [PATCH] Change usage of boolean prop name --- src/components/KYCWall/BaseKYCWall.js | 5 ++--- src/components/KYCWall/index.js | 2 +- src/components/KYCWall/kycWallPropTypes.js | 4 ++-- .../settings/Payments/PaymentsPage/BasePaymentsPage.js | 6 +++--- src/pages/settings/Payments/PaymentsPage/index.js | 2 +- .../settings/Payments/PaymentsPage/paymentsPagePropTypes.js | 4 ++-- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/components/KYCWall/BaseKYCWall.js b/src/components/KYCWall/BaseKYCWall.js index 2963d32bf6e0..dbcd0c39b062 100644 --- a/src/components/KYCWall/BaseKYCWall.js +++ b/src/components/KYCWall/BaseKYCWall.js @@ -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; @@ -63,7 +63,6 @@ class KYCWall extends React.Component { * * @param {Object} position */ - setPositionAddPaymentMenu(position) { this.setState({ anchorPositionTop: position.anchorPositionTop, @@ -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); diff --git a/src/components/KYCWall/index.js b/src/components/KYCWall/index.js index 75732743ac1e..287694560b17 100644 --- a/src/components/KYCWall/index.js +++ b/src/components/KYCWall/index.js @@ -4,7 +4,7 @@ import BaseKYCWall from './BaseKYCWall'; const KYCWall = props => ( // eslint-disable-next-line react/jsx-props-no-spreading - + ); KYCWall.propTypes = propTypes; diff --git a/src/components/KYCWall/kycWallPropTypes.js b/src/components/KYCWall/kycWallPropTypes.js index 2de7db98e50d..40403f120f03 100644 --- a/src/components/KYCWall/kycWallPropTypes.js +++ b/src/components/KYCWall/kycWallPropTypes.js @@ -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, }; @@ -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}; diff --git a/src/pages/settings/Payments/PaymentsPage/BasePaymentsPage.js b/src/pages/settings/Payments/PaymentsPage/BasePaymentsPage.js index 077a7c0b4b8f..0026d1cf0c72 100644 --- a/src/pages/settings/Payments/PaymentsPage/BasePaymentsPage.js +++ b/src/pages/settings/Payments/PaymentsPage/BasePaymentsPage.js @@ -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); @@ -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}); @@ -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}); diff --git a/src/pages/settings/Payments/PaymentsPage/index.js b/src/pages/settings/Payments/PaymentsPage/index.js index 9a53fb9b8e1f..8b819cd7edf6 100644 --- a/src/pages/settings/Payments/PaymentsPage/index.js +++ b/src/pages/settings/Payments/PaymentsPage/index.js @@ -2,7 +2,7 @@ import React from 'react'; import BasePaymentsPage from './BasePaymentsPage'; const PaymentsPage = () => ( - + ); PaymentsPage.displayName = 'PaymentsPage'; diff --git a/src/pages/settings/Payments/PaymentsPage/paymentsPagePropTypes.js b/src/pages/settings/Payments/PaymentsPage/paymentsPagePropTypes.js index fd83f5ade9ff..3c3d6a2d8d11 100644 --- a/src/pages/settings/Payments/PaymentsPage/paymentsPagePropTypes.js +++ b/src/pages/settings/Payments/PaymentsPage/paymentsPagePropTypes.js @@ -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, @@ -27,7 +27,7 @@ const defaultProps = { }, betas: [], isLoadingPaymentMethods: true, - listenResize: false, + shouldListenForResize: false, }; export {propTypes, defaultProps};