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

Fix created view is flickered when marking as unread #30815

Merged
merged 8 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2786,7 +2786,7 @@ const CONST = {
HORIZONTAL_SPACER: {
DEFAULT_BORDER_BOTTOM_WIDTH: 1,
DEFAULT_MARGIN_VERTICAL: 8,
HIDDEN_MARGIN_VERTICAL: 0,
HIDDEN_MARGIN_VERTICAL: 4,
HIDDEN_BORDER_BOTTOM_WIDTH: 0,
},

Expand Down
37 changes: 15 additions & 22 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,15 +555,9 @@ function ReportActionItem(props) {
};

if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED) {
let content = (
<ReportActionItemCreated
reportID={props.report.reportID}
policyID={props.report.policyID}
/>
);
const parentReportAction = ReportActionsUtils.getParentReportAction(props.report);
if (ReportActionsUtils.isTransactionThread(parentReportAction)) {
content = (
return (
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if I understand correctly the reason for returning everywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the past, we didn't return to add the margin-bottom to wrap view of created action. Now we bring the margin to SpacingView so we can earlier return here.

<ShowContextMenuContext.Provider value={contextValue}>
<MoneyRequestView
report={props.report}
Expand All @@ -574,7 +568,7 @@ function ReportActionItem(props) {
}
if (ReportUtils.isTaskReport(props.report)) {
if (ReportUtils.isCanceledTaskReport(props.report, parentReportAction)) {
content = (
return (
<>
<ReportActionItemSingle
action={parentReportAction}
Expand All @@ -587,17 +581,16 @@ function ReportActionItem(props) {
<View style={styles.reportHorizontalRule} />
</>
);
} else {
content = (
<TaskView
report={props.report}
shouldShowHorizontalRule={!props.shouldHideThreadDividerLine}
/>
);
}
return (
<TaskView
report={props.report}
shouldShowHorizontalRule={!props.shouldHideThreadDividerLine}
/>
);
}
if (ReportUtils.isExpenseReport(props.report) || ReportUtils.isIOUReport(props.report)) {
content = (
return (
<OfflineWithFeedback pendingAction={props.action.pendingAction}>
<MoneyReportView
report={props.report}
Expand All @@ -607,12 +600,12 @@ function ReportActionItem(props) {
);
}

const isNormalCreatedAction =
!ReportActionsUtils.isTransactionThread(parentReportAction) &&
!ReportUtils.isTaskReport(props.report) &&
!ReportUtils.isExpenseReport(props.report) &&
!ReportUtils.isIOUReport(props.report);
return <View style={[props.shouldHideThreadDividerLine && !isNormalCreatedAction && styles.mb2]}>{content}</View>;
return (
<ReportActionItemCreated
reportID={props.report.reportID}
policyID={props.report.policyID}
/>
);
}
if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.RENAMED) {
return <RenameAction action={props.action} />;
Expand Down