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

Delete request pop-up does not close when requestee pays the money request #29068

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/components/MoneyRequestHeader.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useState, useCallback} from 'react';
import React, {useState, useCallback, useEffect} from 'react';
import {withOnyx} from 'react-native-onyx';
import {View} from 'react-native';
import PropTypes from 'prop-types';
Expand Down Expand Up @@ -80,13 +80,23 @@ function MoneyRequestHeader({session, parentReport, report, parentReportAction,

const isScanning = TransactionUtils.hasReceipt(transaction) && TransactionUtils.isReceiptBeingScanned(transaction);

const shouldShowThreeDotsButton = isActionOwner && !isSettled && !isApproved;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should call this something more fitting, perhaps canModifyRequest?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you're right
But maybe then canModifyMoneyRequestHeader ?
Because the request sounds too abstract ))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm any ideas @MonilBhavsar?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just go with canModifyRequest for now, because the options in the threedots button modify the request, not the header.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem )

Copy link
Contributor

@MonilBhavsar MonilBhavsar Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

canModifyRequest looks perfect, thanks!

useEffect(() => {
if (shouldShowThreeDotsButton) {
return;
}

setIsDeleteModalVisible(false);
}, [shouldShowThreeDotsButton]);

return (
<>
<View style={[styles.pl0]}>
<HeaderWithBackButton
shouldShowAvatarWithDisplay
shouldShowPinButton={false}
shouldShowThreeDotsButton={isActionOwner && !isSettled && !isApproved}
shouldShowThreeDotsButton={shouldShowThreeDotsButton}
threeDotsMenuItems={[
...(TransactionUtils.hasReceipt(transaction)
? []
Expand Down
Loading