-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49953 from Expensify/revert-48522-fix/48416
Revert "fix: Use new ResolveDuplicates when approver is resolving duplicates"
- Loading branch information
Showing
8 changed files
with
77 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 31 additions & 5 deletions
36
src/components/ReportActionItem/MoneyRequestPreview/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,44 @@ | ||
import lodashIsEmpty from 'lodash/isEmpty'; | ||
import React from 'react'; | ||
import {useOnyx} from 'react-native-onyx'; | ||
import {withOnyx} from 'react-native-onyx'; | ||
import * as ReportActionsUtils from '@libs/ReportActionsUtils'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import MoneyRequestPreviewContent from './MoneyRequestPreviewContent'; | ||
import type {MoneyRequestPreviewProps} from './types'; | ||
import type {MoneyRequestPreviewOnyxProps, MoneyRequestPreviewProps} from './types'; | ||
|
||
function MoneyRequestPreview(props: MoneyRequestPreviewProps) { | ||
const [iouReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${props.iouReportID || '-1'}`); | ||
// We should not render the component if there is no iouReport and it's not a split or track expense. | ||
// Moved outside of the component scope to allow for easier use of hooks in the main component. | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
return lodashIsEmpty(iouReport) && !(props.isBillSplit || props.isTrackExpense) ? null : <MoneyRequestPreviewContent {...props} />; | ||
return lodashIsEmpty(props.iouReport) && !(props.isBillSplit || props.isTrackExpense) ? null : <MoneyRequestPreviewContent {...props} />; | ||
} | ||
|
||
MoneyRequestPreview.displayName = 'MoneyRequestPreview'; | ||
|
||
export default MoneyRequestPreview; | ||
export default withOnyx<MoneyRequestPreviewProps, MoneyRequestPreviewOnyxProps>({ | ||
personalDetails: { | ||
key: ONYXKEYS.PERSONAL_DETAILS_LIST, | ||
}, | ||
chatReport: { | ||
key: ({chatReportID}) => `${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`, | ||
}, | ||
iouReport: { | ||
key: ({iouReportID}) => `${ONYXKEYS.COLLECTION.REPORT}${iouReportID}`, | ||
}, | ||
session: { | ||
key: ONYXKEYS.SESSION, | ||
}, | ||
transaction: { | ||
key: ({action}) => { | ||
const isMoneyRequestAction = ReportActionsUtils.isMoneyRequestAction(action); | ||
const transactionID = isMoneyRequestAction ? ReportActionsUtils.getOriginalMessage(action)?.IOUTransactionID : 0; | ||
return `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`; | ||
}, | ||
}, | ||
walletTerms: { | ||
key: ONYXKEYS.WALLET_TERMS, | ||
}, | ||
transactionViolations: { | ||
key: ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, | ||
}, | ||
})(MoneyRequestPreview); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.