Skip to content

Commit

Permalink
fix: update logic to render thread divider in money report view
Browse files Browse the repository at this point in the history
  • Loading branch information
dominictb committed Aug 6, 2024
1 parent f7e265a commit 898573b
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/components/ReportActionItem/MoneyReportView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import SpacerView from '@components/SpacerView';
import Text from '@components/Text';
import UnreadActionIndicator from '@components/UnreadActionIndicator';
import useLocalize from '@hooks/useLocalize';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
Expand Down Expand Up @@ -76,6 +77,22 @@ function MoneyReportView({report, policy, isCombinedReport = false, shouldShowTo
const shouldShowReportField =
!ReportUtils.isClosedExpenseReportWithNoExpenses(report) && ReportUtils.isPaidGroupPolicyExpenseReport(report) && (!isCombinedReport || !isOnlyTitleFieldEnabled);

const renderThreadDivider = useMemo(
() =>
shouldHideThreadDividerLine && !isCombinedReport ? (
<UnreadActionIndicator
reportActionID={report.reportID}
shouldHideThreadDividerLine={shouldHideThreadDividerLine}
/>
) : (
<SpacerView
shouldShow={!shouldHideThreadDividerLine}
style={[!shouldHideThreadDividerLine ? styles.reportHorizontalRule : {}]}
/>
),
[shouldHideThreadDividerLine, report.reportID, styles.reportHorizontalRule, isCombinedReport],
);

return (
<>
<View style={[styles.pRelative]}>
Expand Down Expand Up @@ -197,12 +214,7 @@ function MoneyReportView({report, policy, isCombinedReport = false, shouldShowTo
</>
)}
</View>
{(shouldShowReportField || shouldShowBreakdown || shouldShowTotal) && (
<SpacerView
shouldShow={!shouldHideThreadDividerLine}
style={[!shouldHideThreadDividerLine ? styles.reportHorizontalRule : {}]}
/>
)}
{(shouldShowReportField || shouldShowBreakdown || shouldShowTotal) && renderThreadDivider}
</>
);
}
Expand Down

0 comments on commit 898573b

Please sign in to comment.