From ccd1b3108922ee0d87c9fe1a0c89c08f40a578dd Mon Sep 17 00:00:00 2001 From: Nikhil Vats Date: Wed, 4 Oct 2023 01:19:15 +0530 Subject: [PATCH 1/4] Fix popover position for payment buttons --- src/components/AddPaymentMethodMenu.js | 12 ++++++++++++ src/components/ButtonWithDropdownMenu.js | 1 + src/components/KYCWall/BaseKYCWall.js | 13 +++++++------ src/components/KYCWall/kycWallPropTypes.js | 16 ++++++++++++---- src/components/MoneyReportHeader.js | 4 ++++ src/components/ReportActionItem/ReportPreview.js | 4 ++++ src/components/SettlementButton.js | 1 + .../settings/Wallet/WalletPage/BaseWalletPage.js | 5 ++++- 8 files changed, 45 insertions(+), 11 deletions(-) diff --git a/src/components/AddPaymentMethodMenu.js b/src/components/AddPaymentMethodMenu.js index 399247a35676..2c3af95a3fad 100644 --- a/src/components/AddPaymentMethodMenu.js +++ b/src/components/AddPaymentMethodMenu.js @@ -1,3 +1,4 @@ +import _ from 'underscore'; import React from 'react'; import PropTypes from 'prop-types'; import {withOnyx} from 'react-native-onyx'; @@ -24,6 +25,12 @@ const propTypes = { vertical: PropTypes.number, }), + /** Where the popover should be positioned relative to the anchor points. */ + anchorAlignment: PropTypes.shape({ + horizontal: PropTypes.oneOf(_.values(CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL)), + vertical: PropTypes.oneOf(_.values(CONST.MODAL.ANCHOR_ORIGIN_VERTICAL)), + }), + /** List of betas available to current user */ betas: PropTypes.arrayOf(PropTypes.string), @@ -35,6 +42,10 @@ const propTypes = { const defaultProps = { anchorPosition: {}, + anchorAlignment: { + horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT, + vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM, + }, betas: [], anchorRef: () => {}, }; @@ -45,6 +56,7 @@ function AddPaymentMethodMenu(props) { isVisible={props.isVisible} onClose={props.onClose} anchorPosition={props.anchorPosition} + anchorAlignment={props.anchorAlignment} anchorRef={props.anchorRef} onItemSelected={props.onClose} menuItems={[ diff --git a/src/components/ButtonWithDropdownMenu.js b/src/components/ButtonWithDropdownMenu.js index a0a6e276bc28..04bc3f6fb54a 100644 --- a/src/components/ButtonWithDropdownMenu.js +++ b/src/components/ButtonWithDropdownMenu.js @@ -143,6 +143,7 @@ function ButtonWithDropdownMenu(props) { ) : (