Skip to content

Commit

Permalink
Merge pull request Expensify#46866 from dominictb/fix/45843-divider
Browse files Browse the repository at this point in the history
fix: update logic to render thread divider in money report view
  • Loading branch information
Beamanator authored Aug 28, 2024
2 parents ff2fa3b + 5985477 commit 071f11c
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 071f11c

Please sign in to comment.