-
Notifications
You must be signed in to change notification settings - Fork 3k
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: keyboard not dismissed #53907
base: main
Are you sure you want to change the base?
fix: keyboard not dismissed #53907
Changes from 5 commits
7194ed0
6b2da07
dbd6f62
df34a1f
af03a2b
9e2bcac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,20 +74,20 @@ function MoneyRequestPreviewContent({ | |
const route = useRoute<PlatformStackRouteProp<TransactionDuplicateNavigatorParamList, typeof SCREENS.TRANSACTION_DUPLICATE.REVIEW>>(); | ||
const {shouldUseNarrowLayout} = useResponsiveLayout(); | ||
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); | ||
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID || '-1'}`); | ||
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`); | ||
const [session] = useOnyx(ONYXKEYS.SESSION); | ||
const [iouReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${iouReportID || '-1'}`); | ||
const [iouReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${iouReportID}`); | ||
|
||
const policy = PolicyUtils.getPolicy(iouReport?.policyID); | ||
const isMoneyRequestAction = ReportActionsUtils.isMoneyRequestAction(action); | ||
const transactionID = isMoneyRequestAction ? ReportActionsUtils.getOriginalMessage(action)?.IOUTransactionID : '-1'; | ||
const transactionID = isMoneyRequestAction ? ReportActionsUtils.getOriginalMessage(action)?.IOUTransactionID : undefined; | ||
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`); | ||
const [walletTerms] = useOnyx(ONYXKEYS.WALLET_TERMS); | ||
const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS); | ||
|
||
const sessionAccountID = session?.accountID; | ||
const managerID = iouReport?.managerID ?? -1; | ||
const ownerAccountID = iouReport?.ownerAccountID ?? -1; | ||
const managerID = iouReport?.managerID ?? CONST.DEFAULT_NUMBER_ID; | ||
const ownerAccountID = iouReport?.ownerAccountID ?? CONST.DEFAULT_NUMBER_ID; | ||
const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(chatReport); | ||
|
||
const participantAccountIDs = | ||
|
@@ -117,9 +117,9 @@ function MoneyRequestPreviewContent({ | |
const isOnHold = TransactionUtils.isOnHold(transaction); | ||
const isSettlementOrApprovalPartial = !!iouReport?.pendingFields?.partial; | ||
const isPartialHold = isSettlementOrApprovalPartial && isOnHold; | ||
const hasViolations = TransactionUtils.hasViolation(transaction?.transactionID ?? '-1', transactionViolations, true); | ||
const hasNoticeTypeViolations = TransactionUtils.hasNoticeTypeViolation(transaction?.transactionID ?? '-1', transactionViolations, true) && ReportUtils.isPaidGroupPolicy(iouReport); | ||
const hasWarningTypeViolations = TransactionUtils.hasWarningTypeViolation(transaction?.transactionID ?? '-1', transactionViolations, true); | ||
const hasViolations = TransactionUtils.hasViolation(transaction?.transactionID, transactionViolations, true); | ||
const hasNoticeTypeViolations = TransactionUtils.hasNoticeTypeViolation(transaction?.transactionID, transactionViolations, true) && ReportUtils.isPaidGroupPolicy(iouReport); | ||
const hasWarningTypeViolations = TransactionUtils.hasWarningTypeViolation(transaction?.transactionID, transactionViolations, true); | ||
const hasFieldErrors = TransactionUtils.hasMissingSmartscanFields(transaction); | ||
const isDistanceRequest = TransactionUtils.isDistanceRequest(transaction); | ||
const isFetchingWaypointsFromServer = TransactionUtils.isFetchingWaypointsFromServer(transaction); | ||
|
@@ -155,8 +155,8 @@ function MoneyRequestPreviewContent({ | |
const shouldShowHoldMessage = !(isSettled && !isSettlementOrApprovalPartial) && !!transaction?.comment?.hold; | ||
|
||
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${route.params?.threadReportID}`); | ||
const parentReportAction = ReportActionsUtils.getReportAction(report?.parentReportID ?? '', report?.parentReportActionID ?? ''); | ||
const reviewingTransactionID = ReportActionsUtils.isMoneyRequestAction(parentReportAction) ? ReportActionsUtils.getOriginalMessage(parentReportAction)?.IOUTransactionID ?? '-1' : '-1'; | ||
const parentReportAction = ReportActionsUtils.getReportAction(report?.parentReportID, report?.parentReportActionID); | ||
const reviewingTransactionID = ReportActionsUtils.isMoneyRequestAction(parentReportAction) ? ReportActionsUtils.getOriginalMessage(parentReportAction)?.IOUTransactionID : undefined; | ||
|
||
/* | ||
Show the merchant for IOUs and expenses only if: | ||
|
@@ -186,7 +186,7 @@ function MoneyRequestPreviewContent({ | |
}; | ||
|
||
const showContextMenu = (event: GestureResponderEvent) => { | ||
if (!shouldDisplayContextMenu) { | ||
if (!shouldDisplayContextMenu || !reportID) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change needed, I don't how it is related to eslint problem, and why can't we leave it as it is? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return; | ||
} | ||
showContextMenuForReport(event, contextMenuAnchor, reportID, action, checkIfContextMenuActive); | ||
|
@@ -253,10 +253,10 @@ function MoneyRequestPreviewContent({ | |
if (TransactionUtils.isPending(transaction)) { | ||
return {shouldShow: true, messageIcon: Expensicons.CreditCardHourglass, messageDescription: translate('iou.transactionPending')}; | ||
} | ||
if (TransactionUtils.shouldShowBrokenConnectionViolation(transaction?.transactionID ?? '-1', iouReport, policy)) { | ||
if (TransactionUtils.shouldShowBrokenConnectionViolation(transaction?.transactionID, iouReport, policy)) { | ||
return {shouldShow: true, messageIcon: Expensicons.Hourglass, messageDescription: translate('violations.brokenConnection530Error')}; | ||
} | ||
if (TransactionUtils.hasPendingUI(transaction, TransactionUtils.getTransactionViolations(transaction?.transactionID ?? '-1', transactionViolations))) { | ||
if (TransactionUtils.hasPendingUI(transaction, TransactionUtils.getTransactionViolations(transaction?.transactionID, transactionViolations))) { | ||
return {shouldShow: true, messageIcon: Expensicons.Hourglass, messageDescription: translate('iou.pendingMatchWithCreditCard')}; | ||
} | ||
return {shouldShow: false}; | ||
|
@@ -301,12 +301,8 @@ function MoneyRequestPreviewContent({ | |
// Clear the draft before selecting a different expense to prevent merging fields from the previous expense | ||
// (e.g., category, tag, tax) that may be not enabled/available in the new expense's policy. | ||
Transaction.abandonReviewDuplicateTransactions(); | ||
const comparisonResult = TransactionUtils.compareDuplicateTransactionFields( | ||
reviewingTransactionID, | ||
transaction?.reportID ?? '', | ||
transaction?.transactionID ?? reviewingTransactionID, | ||
); | ||
Transaction.setReviewDuplicatesKey({...comparisonResult.keep, duplicates, transactionID: transaction?.transactionID ?? '', reportID: transaction?.reportID}); | ||
const comparisonResult = TransactionUtils.compareDuplicateTransactionFields(reviewingTransactionID, transaction?.reportID, transaction?.transactionID ?? reviewingTransactionID); | ||
Transaction.setReviewDuplicatesKey({...comparisonResult.keep, duplicates, transactionID: transaction?.transactionID, reportID: transaction?.reportID}); | ||
|
||
if ('merchant' in comparisonResult.change) { | ||
Navigation.navigate(ROUTES.TRANSACTION_DUPLICATE_REVIEW_MERCHANT_PAGE.getRoute(route.params?.threadReportID, backTo)); | ||
|
@@ -334,6 +330,9 @@ function MoneyRequestPreviewContent({ | |
<OfflineWithFeedback | ||
errors={walletTerms?.errors} | ||
onClose={() => { | ||
if (!chatReportID) { | ||
return; | ||
} | ||
PaymentMethods.clearWalletTermsError(); | ||
Report.clearIOUError(chatReportID); | ||
}} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why used
undefined
instead ofCONST.DEFAULT_NUMBER_ID
here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transactionID
isstring
, so we can’t set it toCONST.DEFAULT_NUMBER_ID
. Also,undefined
andCONST.DEFAULT_NUMBER_ID
has the same effect here, as they’re both falsy.