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

fix non-toggle popover to toggle #24645

Merged
2 changes: 1 addition & 1 deletion src/components/ButtonWithDropdownMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function ButtonWithDropdownMenu(props) {
success
isDisabled={props.isDisabled}
style={[styles.pl0]}
onPress={() => setIsMenuVisible(true)}
onPress={() => setIsMenuVisible(!isMenuVisible)}
shouldRemoveLeftBorderRadius
>
<Icon
Expand Down
12 changes: 9 additions & 3 deletions src/components/KYCWall/BaseKYCWall.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ class KYCWall extends React.Component {
* @param {String} iouPaymentType
*/
continue(event, iouPaymentType) {
if (this.state.shouldShowAddPaymentMenu) {
return;
}
this.setState({transferBalanceButton: event.nativeEvent.target});
const isExpenseReport = ReportUtils.isExpenseReport(this.props.iouReport);
const paymentCardList = this.props.fundList || this.props.cardList || {};
Expand All @@ -113,7 +116,6 @@ class KYCWall extends React.Component {
});
return;
}

if (!isExpenseReport) {
// Ask the user to upgrade to a gold wallet as this means they have not yet gone through our Know Your Customer (KYC) checks
const hasGoldWallet = this.props.userWallet.tierName && this.props.userWallet.tierName === CONST.WALLET.TIER_NAME.GOLD;
Expand All @@ -123,7 +125,6 @@ class KYCWall extends React.Component {
return;
}
}

Log.info('[KYC Wallet] User has valid payment method and passed KYC checks or did not need them');
this.props.onSuccessfulKYC(iouPaymentType);
}
Expand All @@ -133,7 +134,12 @@ class KYCWall extends React.Component {
<>
<AddPaymentMethodMenu
isVisible={this.state.shouldShowAddPaymentMenu}
onClose={() => this.setState({shouldShowAddPaymentMenu: false})}
onClose={() => {
/* a small delay will schedule this to run after the continue method preventing rerendering of the menu when clicking the menu item */
setTimeout(() => {
this.setState({shouldShowAddPaymentMenu: false});
}, 10);
ishpaul777 marked this conversation as resolved.
Show resolved Hide resolved
}}
anchorPosition={{
vertical: this.state.anchorPositionVertical,
horizontal: this.state.anchorPositionHorizontal,
Expand Down
4 changes: 4 additions & 0 deletions src/components/ThreeDotsMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ function ThreeDotsMenu({iconTooltip, icon, iconFill, iconStyles, onIconPress, me
<Tooltip text={translate(iconTooltip)}>
<PressableWithoutFeedback
onPress={() => {
if (isPopupMenuVisible) {
hidePopoverMenu();
return;
}
showPopoverMenu();
if (onIconPress) {
onIconPress();
Expand Down
5 changes: 5 additions & 0 deletions src/pages/settings/Payments/PaymentsPage/BasePaymentsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ function BasePaymentsPage(props) {
* @param {String|Number} methodID
*/
const paymentMethodPressed = (nativeEvent, accountType, account, isDefault, methodID) => {
if (shouldShowAddPaymentMenu) {
setShouldShowAddPaymentMenu(false);
return;
}

paymentMethodButtonRef.current = nativeEvent.currentTarget;

// The delete/default menu
Expand Down