Skip to content

Commit

Permalink
Merge pull request #29361 from Nikhil-Vats/29332_send_payment_popover
Browse files Browse the repository at this point in the history
Fix send button popover position
  • Loading branch information
luacmartins authored Oct 22, 2023
2 parents f6661a1 + a2bdeea commit 3656ae1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
4 changes: 0 additions & 4 deletions src/components/MoneyReportHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, nextSt
shouldShowPaymentOptions
style={[styles.pv2]}
formattedAmount={formattedAmount}
anchorAlignment={{
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT,
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP,
}}
/>
</View>
)}
Expand Down
6 changes: 5 additions & 1 deletion src/components/MoneyRequestConfirmationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,11 @@ function MoneyRequestConfirmationList(props) {
policyID={props.policyID}
shouldShowPaymentOptions
buttonSize={CONST.DROPDOWN_BUTTON_SIZE.LARGE}
anchorAlignment={{
kycWallAnchorAlignment={{
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT,
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM,
}}
paymentMethodDropdownAnchorAlignment={{
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT,
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM,
}}
Expand Down
8 changes: 6 additions & 2 deletions src/components/ReportActionItem/ReportPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,13 @@ function ReportPreview(props) {
onPress={(paymentType) => IOU.payMoneyRequest(paymentType, props.chatReport, props.iouReport)}
enablePaymentsRoute={ROUTES.ENABLE_PAYMENTS}
addBankAccountRoute={bankAccountRoute}
style={[styles.mt3]}
shouldShowPaymentOptions
anchorAlignment={{
style={[styles.mt3]}
kycWallAnchorAlignment={{
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT,
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM,
}}
paymentMethodDropdownAnchorAlignment={{
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT,
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM,
}}
Expand Down
25 changes: 18 additions & 7 deletions src/components/SettlementButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,14 @@ const propTypes = {
/** Whether we should show a loading state for the main button */
isLoading: PropTypes.bool,

/** The anchor alignment of the popover menu */
anchorAlignment: PropTypes.shape({
/** The anchor alignment of the popover menu for payment method dropdown */
paymentMethodDropdownAnchorAlignment: PropTypes.shape({
horizontal: PropTypes.oneOf(_.values(CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL)),
vertical: PropTypes.oneOf(_.values(CONST.MODAL.ANCHOR_ORIGIN_VERTICAL)),
}),

/** The anchor alignment of the popover menu for KYC wall popover */
kycWallAnchorAlignment: PropTypes.shape({
horizontal: PropTypes.oneOf(_.values(CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL)),
vertical: PropTypes.oneOf(_.values(CONST.MODAL.ANCHOR_ORIGIN_VERTICAL)),
}),
Expand All @@ -96,16 +102,21 @@ const defaultProps = {
policyID: '',
formattedAmount: '',
buttonSize: CONST.DROPDOWN_BUTTON_SIZE.MEDIUM,
anchorAlignment: {
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT,
kycWallAnchorAlignment: {
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT, // button is at left, so horizontal anchor is at LEFT
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP, // we assume that popover menu opens below the button, anchor is at TOP
},
paymentMethodDropdownAnchorAlignment: {
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT, // caret for dropdown is at right, so horizontal anchor is at RIGHT
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP, // we assume that popover menu opens below the button, anchor is at TOP
},
};

function SettlementButton({
addDebitCardRoute,
addBankAccountRoute,
anchorAlignment,
kycWallAnchorAlignment,
paymentMethodDropdownAnchorAlignment,
betas,
buttonSize,
chatReportID,
Expand Down Expand Up @@ -210,7 +221,7 @@ function SettlementButton({
source={CONST.KYC_WALL_SOURCE.REPORT}
chatReportID={chatReportID}
iouReport={iouReport}
anchorAlignment={anchorAlignment}
anchorAlignment={kycWallAnchorAlignment}
>
{(triggerKYCFlow, buttonRef) => (
<ButtonWithDropdownMenu
Expand All @@ -222,7 +233,7 @@ function SettlementButton({
options={paymentButtonOptions}
style={style}
buttonSize={buttonSize}
anchorAlignment={anchorAlignment}
anchorAlignment={paymentMethodDropdownAnchorAlignment}
/>
)}
</KYCWall>
Expand Down

0 comments on commit 3656ae1

Please sign in to comment.