|
1 | 1 | import {createPoliciesSelector} from '@selectors/Policy'; |
2 | 2 | import React, {useMemo} from 'react'; |
3 | 3 | import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; |
| 4 | +import * as Expensicons from '@components/Icon/Expensicons'; |
4 | 5 | import MenuItem from '@components/MenuItem'; |
5 | 6 | import {useOptionsList} from '@components/OptionListContextProvider'; |
6 | 7 | import SelectionList from '@components/SelectionList'; |
7 | 8 | import InviteMemberListItem from '@components/SelectionList/ListItem/InviteMemberListItem'; |
8 | 9 | import type {ListItem} from '@components/SelectionList/types'; |
9 | 10 | import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; |
10 | 11 | import useDebouncedState from '@hooks/useDebouncedState'; |
11 | | -import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; |
12 | 12 | import useLocalize from '@hooks/useLocalize'; |
13 | 13 | import useOnyx from '@hooks/useOnyx'; |
14 | 14 | import usePolicy from '@hooks/usePolicy'; |
15 | 15 | import usePolicyForMovingExpenses from '@hooks/usePolicyForMovingExpenses'; |
16 | 16 | import useReportTransactions from '@hooks/useReportTransactions'; |
17 | 17 | import Navigation from '@libs/Navigation/Navigation'; |
18 | 18 | import {canSubmitPerDiemExpenseFromWorkspace, getPersonalPolicy, isPolicyAdmin} from '@libs/PolicyUtils'; |
19 | | -import { |
20 | | - canAddTransaction, |
21 | | - getOutstandingReportsForUser, |
22 | | - getPolicyName, |
23 | | - getReportName, |
24 | | - isIOUReport, |
25 | | - isOpenReport, |
26 | | - isReportOwner, |
27 | | - isSelfDM, |
28 | | - sortOutstandingReportsBySelected, |
29 | | -} from '@libs/ReportUtils'; |
| 19 | +import {canAddTransaction, getOutstandingReportsForUser, getPolicyName, isIOUReport, isOpenReport, isReportOwner, isSelfDM, sortOutstandingReportsBySelected} from '@libs/ReportUtils'; |
30 | 20 | import CONST from '@src/CONST'; |
31 | 21 | import ONYXKEYS from '@src/ONYXKEYS'; |
32 | 22 | import type {Route} from '@src/ROUTES'; |
@@ -73,7 +63,6 @@ function IOURequestEditReportCommon({ |
73 | 63 | isPerDiemRequest, |
74 | 64 | }: Props) { |
75 | 65 | const {translate, localeCompare} = useLocalize(); |
76 | | - const icons = useMemoizedLazyExpensifyIcons(['Document', 'Close'] as const); |
77 | 66 | const {options} = useOptionsList(); |
78 | 67 | const [outstandingReportsByPolicyID] = useOnyx(ONYXKEYS.DERIVED.OUTSTANDING_REPORTS_BY_POLICY_ID, {canBeMissing: true}); |
79 | 68 | const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true}); |
@@ -181,12 +170,11 @@ function IOURequestEditReportCommon({ |
181 | 170 | .map((report) => { |
182 | 171 | const matchingOption = options.reports.find((option) => option.reportID === report.reportID); |
183 | 172 | return { |
184 | | - ...(matchingOption ?? report), |
| 173 | + ...matchingOption, |
185 | 174 | // We are shallow copying properties from matchingOption, so if it has a brickRoadIndicator, it will display RBR. |
186 | 175 | // We set it to null here to prevent showing RBR for reports https://github.com/Expensify/App/issues/65960. |
187 | 176 | brickRoadIndicator: null, |
188 | 177 | alternateText: getPolicyName({report}) ?? matchingOption?.alternateText, |
189 | | - text: getReportName(report), |
190 | 178 | value: report.reportID, |
191 | 179 | keyForList: report.reportID, |
192 | 180 | isSelected: report.reportID === selectedReportID, |
@@ -221,10 +209,10 @@ function IOURequestEditReportCommon({ |
221 | 209 | onPress={createReport} |
222 | 210 | title={translate('report.newReport.createReport')} |
223 | 211 | description={policyForMovingExpenses?.name} |
224 | | - icon={icons.Document} |
| 212 | + icon={Expensicons.Document} |
225 | 213 | /> |
226 | 214 | ); |
227 | | - }, [createReport, isEditing, isOwner, translate, policyForMovingExpenses?.name, icons.Document]); |
| 215 | + }, [createReport, isEditing, isOwner, translate, policyForMovingExpenses?.name]); |
228 | 216 |
|
229 | 217 | // eslint-disable-next-line rulesdir/no-negated-variables |
230 | 218 | const shouldShowNotFoundPage = useMemo(() => { |
@@ -276,7 +264,7 @@ function IOURequestEditReportCommon({ |
276 | 264 | onPress={removeFromReport} |
277 | 265 | title={translate('iou.removeFromReport')} |
278 | 266 | description={translate('iou.moveToPersonalSpace')} |
279 | | - icon={icons.Close} |
| 267 | + icon={Expensicons.Close} |
280 | 268 | /> |
281 | 269 | )} |
282 | 270 | {createReportOption} |
|
0 commit comments