|
1 | 1 | import _ from 'underscore';
|
2 | 2 | import lodashGet from 'lodash/get';
|
3 |
| -import React, {useState, useRef, useEffect, memo, useCallback, useContext} from 'react'; |
| 3 | +import React, {useState, useRef, useEffect, memo, useCallback, useContext, useMemo} from 'react'; |
4 | 4 | import {InteractionManager, View} from 'react-native';
|
5 | 5 | import PropTypes from 'prop-types';
|
6 | 6 | import {withOnyx} from 'react-native-onyx';
|
@@ -61,12 +61,13 @@ import * as Session from '../../../libs/actions/Session';
|
61 | 61 | import MoneyRequestView from '../../../components/ReportActionItem/MoneyRequestView';
|
62 | 62 | import {hideContextMenu} from './ContextMenu/ReportActionContextMenu';
|
63 | 63 | import * as PersonalDetailsUtils from '../../../libs/PersonalDetailsUtils';
|
64 |
| -import ReportActionItemBasicMessage from './ReportActionItemBasicMessage'; |
65 | 64 | import * as store from '../../../libs/actions/ReimbursementAccount/store';
|
66 | 65 | import * as BankAccounts from '../../../libs/actions/BankAccounts';
|
67 | 66 | import {ReactionListContext} from '../ReportScreenContext';
|
68 | 67 | import usePrevious from '../../../hooks/usePrevious';
|
69 | 68 | import Permissions from '../../../libs/Permissions';
|
| 69 | +import themeColors from '../../../styles/themes/default'; |
| 70 | +import ReportActionItemBasicMessage from './ReportActionItemBasicMessage'; |
70 | 71 | import RenderHTML from '../../../components/RenderHTML';
|
71 | 72 | import ReportAttachmentsContext from './ReportAttachmentsContext';
|
72 | 73 |
|
@@ -138,6 +139,9 @@ function ReportActionItem(props) {
|
138 | 139 | const prevDraftMessage = usePrevious(props.draftMessage);
|
139 | 140 | const originalReportID = ReportUtils.getOriginalReportID(props.report.reportID, props.action);
|
140 | 141 | const originalReport = props.report.reportID === originalReportID ? props.report : ReportUtils.getReport(originalReportID);
|
| 142 | + const isReportActionLinked = props.linkedReportActionID === props.action.reportActionID; |
| 143 | + |
| 144 | + const highlightedBackgroundColorIfNeeded = useMemo(() => (isReportActionLinked ? StyleUtils.getBackgroundColorStyle(themeColors.highlightBG) : {}), [isReportActionLinked]); |
141 | 145 |
|
142 | 146 | // When active action changes, we need to update the `isContextMenuActive` state
|
143 | 147 | const isActiveReportActionForMenu = ReportActionContextMenu.isActiveReportAction(props.action.reportActionID);
|
@@ -594,7 +598,7 @@ function ReportActionItem(props) {
|
594 | 598 | disabled={Boolean(props.draftMessage)}
|
595 | 599 | >
|
596 | 600 | {(hovered) => (
|
597 |
| - <View> |
| 601 | + <View style={highlightedBackgroundColorIfNeeded}> |
598 | 602 | {props.shouldDisplayNewMarker && <UnreadActionIndicator reportActionID={props.action.reportActionID} />}
|
599 | 603 | <MiniReportActionContextMenu
|
600 | 604 | reportID={props.report.reportID}
|
@@ -638,7 +642,7 @@ function ReportActionItem(props) {
|
638 | 642 | />
|
639 | 643 | </View>
|
640 | 644 | )}
|
641 |
| - {renderReportActionItem(hovered, isWhisper, hasErrors)} |
| 645 | + {renderReportActionItem(hovered || isReportActionLinked, isWhisper, hasErrors)} |
642 | 646 | </OfflineWithFeedback>
|
643 | 647 | </View>
|
644 | 648 | </View>
|
@@ -711,6 +715,7 @@ export default compose(
|
711 | 715 | prevProps.report.managerID === nextProps.report.managerID &&
|
712 | 716 | prevProps.report.managerEmail === nextProps.report.managerEmail &&
|
713 | 717 | prevProps.shouldHideThreadDividerLine === nextProps.shouldHideThreadDividerLine &&
|
714 |
| - lodashGet(prevProps.report, 'total', 0) === lodashGet(nextProps.report, 'total', 0), |
| 718 | + lodashGet(prevProps.report, 'total', 0) === lodashGet(nextProps.report, 'total', 0) && |
| 719 | + prevProps.linkedReportActionID === nextProps.linkedReportActionID, |
715 | 720 | ),
|
716 | 721 | );
|
0 commit comments