-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
AttachmentModal.tsx
631 lines (565 loc) · 25.5 KB
/
AttachmentModal.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
import Str from 'expensify-common/lib/str';
import React, {memo, useCallback, useEffect, useMemo, useState} from 'react';
import {Animated, Keyboard, View} from 'react-native';
import {GestureHandlerRootView} from 'react-native-gesture-handler';
import {withOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import {useSharedValue} from 'react-native-reanimated';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import addEncryptedAuthTokenToURL from '@libs/addEncryptedAuthTokenToURL';
import fileDownload from '@libs/fileDownload';
import * as FileUtils from '@libs/fileDownload/FileUtils';
import Navigation from '@libs/Navigation/Navigation';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import * as TransactionUtils from '@libs/TransactionUtils';
import useNativeDriver from '@libs/useNativeDriver';
import type {AvatarSource} from '@libs/UserUtils';
import variables from '@styles/variables';
import * as IOU from '@userActions/IOU';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type * as OnyxTypes from '@src/types/onyx';
import type {EmptyObject} from '@src/types/utils/EmptyObject';
import {isEmptyObject} from '@src/types/utils/EmptyObject';
import type ModalType from '@src/types/utils/ModalType';
import AttachmentCarousel from './Attachments/AttachmentCarousel';
import AttachmentCarouselPagerContext from './Attachments/AttachmentCarousel/Pager/AttachmentCarouselPagerContext';
import AttachmentView from './Attachments/AttachmentView';
import type {Attachment} from './Attachments/types';
import BlockingView from './BlockingViews/BlockingView';
import Button from './Button';
import ConfirmModal from './ConfirmModal';
import FullScreenLoadingIndicator from './FullscreenLoadingIndicator';
import HeaderGap from './HeaderGap';
import HeaderWithBackButton from './HeaderWithBackButton';
import * as Expensicons from './Icon/Expensicons';
import * as Illustrations from './Icon/Illustrations';
import Modal from './Modal';
import SafeAreaConsumer from './SafeAreaConsumer';
/**
* Modal render prop component that exposes modal launching triggers that can be used
* to display a full size image or PDF modally with optional confirmation button.
*/
type AttachmentModalOnyxProps = {
/** The transaction associated with the receipt attachment, if any */
transaction: OnyxEntry<OnyxTypes.Transaction>;
/** The report associated with the receipt attachment, if any */
parentReport: OnyxEntry<OnyxTypes.Report>;
/** The policy associated with the receipt attachment, if any */
policy: OnyxEntry<OnyxTypes.Policy>;
/** The list of report actions associated with the receipt attachment, if any */
parentReportActions: OnyxEntry<OnyxTypes.ReportActions>;
};
type ImagePickerResponse = {
height?: number;
name: string;
size?: number | null;
type: string;
uri: string;
width?: number;
};
type FileObject = Partial<File | ImagePickerResponse>;
type ChildrenProps = {
displayFileInModal: (data: FileObject) => void;
show: () => void;
};
type AttachmentModalProps = AttachmentModalOnyxProps & {
/** Optional source (URL, SVG function) for the image shown. If not passed in via props must be specified when modal is opened. */
source?: AvatarSource;
/** Optional callback to fire when we want to preview an image and approve it for use. */
onConfirm?: ((file: FileObject) => void) | null;
/** Whether the modal should be open by default */
defaultOpen?: boolean;
/** Trigger when we explicity click close button in ProfileAttachment modal */
onModalClose?: () => void;
/** Optional original filename when uploading */
originalFileName?: string;
/** Whether source url requires authentication */
isAuthTokenRequired?: boolean;
/** Determines if download Button should be shown or not */
allowDownload?: boolean;
/** Title shown in the header of the modal */
headerTitle?: string;
/** The report that has this attachment */
report?: OnyxEntry<OnyxTypes.Report> | EmptyObject;
/** Optional callback to fire when we want to do something after modal show. */
onModalShow?: () => void;
/** Optional callback to fire when we want to do something after modal hide. */
onModalHide?: () => void;
/** The data is loading or not */
isLoading?: boolean;
/** Should display not found page or not */
shouldShowNotFoundPage?: boolean;
/** Optional callback to fire when we want to do something after attachment carousel changes. */
onCarouselAttachmentChange?: (attachment: Attachment) => void;
/** Denotes whether it is a workspace avatar or not */
isWorkspaceAvatar?: boolean;
/** Denotes whether it can be an icon (ex: SVG) */
maybeIcon?: boolean;
/** Whether it is a receipt attachment or not */
isReceiptAttachment?: boolean;
/** A function as a child to pass modal launching methods to */
children?: React.FC<ChildrenProps>;
fallbackSource?: AvatarSource;
canEditReceipt?: boolean;
};
function AttachmentModal({
source = '',
onConfirm,
defaultOpen = false,
originalFileName = '',
isAuthTokenRequired = false,
allowDownload = false,
report,
onModalShow = () => {},
onModalHide = () => {},
onCarouselAttachmentChange = () => {},
isReceiptAttachment = false,
isWorkspaceAvatar = false,
maybeIcon = false,
transaction,
parentReport,
parentReportActions,
headerTitle,
policy,
children,
fallbackSource,
canEditReceipt = false,
onModalClose = () => {},
isLoading = false,
shouldShowNotFoundPage = false,
}: AttachmentModalProps) {
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const [isModalOpen, setIsModalOpen] = useState(defaultOpen);
const [shouldLoadAttachment, setShouldLoadAttachment] = useState(false);
const [isAttachmentInvalid, setIsAttachmentInvalid] = useState(false);
const [isDeleteReceiptConfirmModalVisible, setIsDeleteReceiptConfirmModalVisible] = useState(false);
const [isAuthTokenRequiredState, setIsAuthTokenRequiredState] = useState(isAuthTokenRequired);
const [attachmentInvalidReasonTitle, setAttachmentInvalidReasonTitle] = useState<TranslationPaths | null>(null);
const [attachmentInvalidReason, setAttachmentInvalidReason] = useState<TranslationPaths | null>(null);
const [sourceState, setSourceState] = useState<AvatarSource>(() => source);
const [modalType, setModalType] = useState<ModalType>(CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE);
const [isConfirmButtonDisabled, setIsConfirmButtonDisabled] = useState(false);
const [confirmButtonFadeAnimation] = useState(() => new Animated.Value(1));
const [isDownloadButtonReadyToBeShown, setIsDownloadButtonReadyToBeShown] = React.useState(true);
const nope = useSharedValue(false);
const {windowWidth, isSmallScreenWidth} = useWindowDimensions();
const isOverlayModalVisible = (isReceiptAttachment && isDeleteReceiptConfirmModalVisible) || (!isReceiptAttachment && isAttachmentInvalid);
const [file, setFile] = useState<FileObject | undefined>(
originalFileName
? {
name: originalFileName,
}
: undefined,
);
const {translate} = useLocalize();
const {isOffline} = useNetwork();
useEffect(() => {
setFile(originalFileName ? {name: originalFileName} : undefined);
}, [originalFileName]);
/**
* Keeps the attachment source in sync with the attachment displayed currently in the carousel.
*/
const onNavigate = useCallback(
(attachment: Attachment) => {
setSourceState(attachment.source);
setFile(attachment.file);
setIsAuthTokenRequiredState(attachment.isAuthTokenRequired ?? false);
onCarouselAttachmentChange(attachment);
},
[onCarouselAttachmentChange],
);
/**
* If our attachment is a PDF, return the unswipeablge Modal type.
*/
const getModalType = useCallback(
(sourceURL: string, fileObject: FileObject) =>
sourceURL && (Str.isPDF(sourceURL) || (fileObject && Str.isPDF(fileObject.name ?? translate('attachmentView.unknownFilename'))))
? CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE
: CONST.MODAL.MODAL_TYPE.CENTERED,
[translate],
);
const setDownloadButtonVisibility = useCallback(
(isButtonVisible: boolean) => {
if (isDownloadButtonReadyToBeShown === isButtonVisible) {
return;
}
setIsDownloadButtonReadyToBeShown(isButtonVisible);
},
[isDownloadButtonReadyToBeShown],
);
/**
* Download the currently viewed attachment.
*/
const downloadAttachment = useCallback(() => {
let sourceURL = sourceState;
if (isAuthTokenRequiredState && typeof sourceURL === 'string') {
sourceURL = addEncryptedAuthTokenToURL(sourceURL);
}
if (typeof sourceURL === 'string') {
fileDownload(sourceURL, file?.name ?? '');
}
// At ios, if the keyboard is open while opening the attachment, then after downloading
// the attachment keyboard will show up. So, to fix it we need to dismiss the keyboard.
Keyboard.dismiss();
}, [isAuthTokenRequiredState, sourceState, file]);
/**
* Execute the onConfirm callback and close the modal.
*/
const submitAndClose = useCallback(() => {
// If the modal has already been closed or the confirm button is disabled
// do not submit.
if (!isModalOpen || isConfirmButtonDisabled) {
return;
}
if (onConfirm) {
onConfirm(Object.assign(file ?? {}, {source: sourceState} as FileObject));
}
setIsModalOpen(false);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isModalOpen, isConfirmButtonDisabled, onConfirm, file, sourceState]);
/**
* Close the confirm modals.
*/
const closeConfirmModal = useCallback(() => {
setIsAttachmentInvalid(false);
setIsDeleteReceiptConfirmModalVisible(false);
}, []);
/**
* Detach the receipt and close the modal.
*/
const deleteAndCloseModal = useCallback(() => {
IOU.detachReceipt(transaction?.transactionID ?? '');
setIsDeleteReceiptConfirmModalVisible(false);
Navigation.goBack(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(report?.reportID ?? ''));
}, [transaction, report]);
const isValidFile = useCallback((fileObject: FileObject) => {
if (fileObject.size && fileObject.size > CONST.API_ATTACHMENT_VALIDATIONS.MAX_SIZE) {
setIsAttachmentInvalid(true);
setAttachmentInvalidReasonTitle('attachmentPicker.attachmentTooLarge');
setAttachmentInvalidReason('attachmentPicker.sizeExceeded');
return false;
}
if (fileObject.size && fileObject.size < CONST.API_ATTACHMENT_VALIDATIONS.MIN_SIZE) {
setIsAttachmentInvalid(true);
setAttachmentInvalidReasonTitle('attachmentPicker.attachmentTooSmall');
setAttachmentInvalidReason('attachmentPicker.sizeNotMet');
return false;
}
return true;
}, []);
const isDirectoryCheck = useCallback((data: FileObject) => {
if ('webkitGetAsEntry' in data && typeof data.webkitGetAsEntry === 'function' && data.webkitGetAsEntry().isDirectory) {
setIsAttachmentInvalid(true);
setAttachmentInvalidReasonTitle('attachmentPicker.attachmentError');
setAttachmentInvalidReason('attachmentPicker.folderNotAllowedMessage');
return false;
}
return true;
}, []);
const validateAndDisplayFileToUpload = useCallback(
(data: FileObject) => {
if (!data || !isDirectoryCheck(data)) {
return;
}
let fileObject = data;
if ('getAsFile' in data && typeof data.getAsFile === 'function') {
fileObject = data.getAsFile();
}
if (!fileObject) {
return;
}
if (!isValidFile(fileObject)) {
return;
}
if (fileObject instanceof File) {
/**
* Cleaning file name, done here so that it covers all cases:
* upload, drag and drop, copy-paste
*/
let updatedFile = fileObject;
const cleanName = FileUtils.cleanFileName(updatedFile.name);
if (updatedFile.name !== cleanName) {
updatedFile = new File([updatedFile], cleanName, {type: updatedFile.type});
}
const inputSource = URL.createObjectURL(updatedFile);
const inputModalType = getModalType(inputSource, updatedFile);
setIsModalOpen(true);
setSourceState(inputSource);
setFile(updatedFile);
setModalType(inputModalType);
} else if (fileObject.uri) {
const inputModalType = getModalType(fileObject.uri, fileObject);
setIsModalOpen(true);
setSourceState(fileObject.uri);
setFile(fileObject);
setModalType(inputModalType);
}
},
[isValidFile, getModalType, isDirectoryCheck],
);
/**
* In order to gracefully hide/show the confirm button when the keyboard
* opens/closes, apply an animation to fade the confirm button out/in. And since
* we're only updating the opacity of the confirm button, we must also conditionally
* disable it.
*
* @param shouldFadeOut If true, fade out confirm button. Otherwise fade in.
*/
const updateConfirmButtonVisibility = useCallback(
(shouldFadeOut: boolean) => {
setIsConfirmButtonDisabled(shouldFadeOut);
const toValue = shouldFadeOut ? 0 : 1;
Animated.timing(confirmButtonFadeAnimation, {
toValue,
duration: 100,
useNativeDriver,
}).start();
},
[confirmButtonFadeAnimation],
);
/**
* close the modal
*/
const closeModal = useCallback(() => {
setIsModalOpen(false);
if (typeof onModalClose === 'function') {
onModalClose();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [onModalClose]);
/**
* open the modal
*/
const openModal = useCallback(() => {
setIsModalOpen(true);
}, []);
useEffect(() => {
setSourceState(() => source);
}, [source]);
useEffect(() => {
setIsAuthTokenRequiredState(isAuthTokenRequired);
}, [isAuthTokenRequired]);
const sourceForAttachmentView = sourceState || source;
const threeDotsMenuItems = useMemo(() => {
if (!isReceiptAttachment || !parentReport || !parentReportActions) {
return [];
}
const menuItems = [];
if (canEditReceipt) {
menuItems.push({
icon: Expensicons.Camera,
text: translate('common.replace'),
onSelected: () => {
closeModal();
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_SCAN.getRoute(
CONST.IOU.ACTION.EDIT,
CONST.IOU.TYPE.REQUEST,
transaction?.transactionID ?? '',
report?.reportID ?? '',
Navigation.getActiveRouteWithoutParams(),
),
);
},
});
}
if (!isOffline && allowDownload) {
menuItems.push({
icon: Expensicons.Download,
text: translate('common.download'),
onSelected: () => downloadAttachment(),
});
}
if (TransactionUtils.hasReceipt(transaction) && !TransactionUtils.isReceiptBeingScanned(transaction) && canEditReceipt && !TransactionUtils.hasMissingSmartscanFields(transaction)) {
menuItems.push({
icon: Expensicons.Trashcan,
text: translate('receipt.deleteReceipt'),
onSelected: () => {
setIsDeleteReceiptConfirmModalVisible(true);
},
});
}
return menuItems;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isReceiptAttachment, parentReport, parentReportActions, policy, transaction, file, sourceState]);
// There are a few things that shouldn't be set until we absolutely know if the file is a receipt or an attachment.
// props.isReceiptAttachment will be null until its certain what the file is, in which case it will then be true|false.
let headerTitleNew = headerTitle;
let shouldShowDownloadButton = false;
let shouldShowThreeDotsButton = false;
if (!isEmptyObject(report)) {
headerTitleNew = translate(isReceiptAttachment ? 'common.receipt' : 'common.attachment');
shouldShowDownloadButton = allowDownload && isDownloadButtonReadyToBeShown && !isReceiptAttachment && !isOffline;
shouldShowThreeDotsButton = isReceiptAttachment && isModalOpen && threeDotsMenuItems.length !== 0;
}
const context = useMemo(
() => ({
pagerItems: [],
activePage: 0,
pagerRef: undefined,
isPagerScrolling: nope,
isScrollEnabled: nope,
onTap: () => {},
onScaleChanged: () => {},
onSwipeDown: closeModal,
}),
[closeModal, nope],
);
return (
<>
<Modal
type={modalType}
onSubmit={submitAndClose}
onClose={isOverlayModalVisible ? closeConfirmModal : closeModal}
isVisible={isModalOpen}
onModalShow={() => {
onModalShow();
setShouldLoadAttachment(true);
}}
onModalHide={() => {
onModalHide();
setShouldLoadAttachment(false);
}}
propagateSwipe
>
<GestureHandlerRootView style={styles.flex1}>
{isSmallScreenWidth && <HeaderGap />}
<HeaderWithBackButton
title={headerTitleNew}
shouldShowBorderBottom
shouldShowDownloadButton={shouldShowDownloadButton}
onDownloadButtonPress={() => downloadAttachment()}
shouldShowCloseButton={!isSmallScreenWidth}
shouldShowBackButton={isSmallScreenWidth}
onBackButtonPress={closeModal}
onCloseButtonPress={closeModal}
shouldShowThreeDotsButton={shouldShowThreeDotsButton}
threeDotsAnchorPosition={styles.threeDotsPopoverOffsetAttachmentModal(windowWidth)}
threeDotsMenuItems={threeDotsMenuItems}
shouldOverlayDots
/>
<View style={styles.imageModalImageCenterContainer}>
{isLoading && <FullScreenLoadingIndicator />}
{shouldShowNotFoundPage && !isLoading && (
<BlockingView
icon={Illustrations.ToddBehindCloud}
iconWidth={variables.modalTopIconWidth}
iconHeight={variables.modalTopIconHeight}
title={translate('notFound.notHere')}
subtitle={translate('notFound.pageNotFound')}
linkKey="notFound.goBackHome"
shouldShowLink
onLinkPress={() => Navigation.dismissModal()}
/>
)}
{!isEmptyObject(report) && !isReceiptAttachment ? (
<AttachmentCarousel
report={report}
onNavigate={onNavigate}
onClose={closeModal}
source={source}
setDownloadButtonVisibility={setDownloadButtonVisibility}
/>
) : (
!!sourceForAttachmentView &&
shouldLoadAttachment &&
!isLoading &&
!shouldShowNotFoundPage && (
<AttachmentCarouselPagerContext.Provider value={context}>
<AttachmentView
containerStyles={[styles.mh5]}
source={sourceForAttachmentView}
isAuthTokenRequired={isAuthTokenRequiredState}
file={file}
onToggleKeyboard={updateConfirmButtonVisibility}
isWorkspaceAvatar={isWorkspaceAvatar}
maybeIcon={maybeIcon}
fallbackSource={fallbackSource}
isUsedInAttachmentModal
transactionID={transaction?.transactionID}
/>
</AttachmentCarouselPagerContext.Provider>
)
)}
</View>
{/* If we have an onConfirm method show a confirmation button */}
{!!onConfirm && (
<SafeAreaConsumer>
{({safeAreaPaddingBottomStyle}) => (
<Animated.View style={[StyleUtils.fade(confirmButtonFadeAnimation), safeAreaPaddingBottomStyle]}>
<Button
success
large
style={[styles.buttonConfirm, isSmallScreenWidth ? {} : styles.attachmentButtonBigScreen]}
textStyles={[styles.buttonConfirmText]}
text={translate('common.send')}
onPress={submitAndClose}
isDisabled={isConfirmButtonDisabled}
pressOnEnter
/>
</Animated.View>
)}
</SafeAreaConsumer>
)}
{isReceiptAttachment && (
<ConfirmModal
title={translate('receipt.deleteReceipt')}
isVisible={isDeleteReceiptConfirmModalVisible}
onConfirm={deleteAndCloseModal}
onCancel={closeConfirmModal}
prompt={translate('receipt.deleteConfirmation')}
confirmText={translate('common.delete')}
cancelText={translate('common.cancel')}
danger
/>
)}
</GestureHandlerRootView>
</Modal>
{!isReceiptAttachment && (
<ConfirmModal
title={attachmentInvalidReasonTitle ? translate(attachmentInvalidReasonTitle) : ''}
onConfirm={closeConfirmModal}
onCancel={closeConfirmModal}
isVisible={isAttachmentInvalid}
prompt={attachmentInvalidReason ? translate(attachmentInvalidReason) : ''}
confirmText={translate('common.close')}
shouldShowCancelButton={false}
/>
)}
{children?.({
displayFileInModal: validateAndDisplayFileToUpload,
show: openModal,
})}
</>
);
}
AttachmentModal.displayName = 'AttachmentModal';
export default withOnyx<AttachmentModalProps, AttachmentModalOnyxProps>({
transaction: {
key: ({report}) => {
const parentReportAction = ReportActionsUtils.getReportAction(report?.parentReportID ?? '', report?.parentReportActionID ?? '');
const transactionID = parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU ? parentReportAction?.originalMessage.IOUTransactionID ?? '0' : '0';
return `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`;
},
initWithStoredValues: false,
},
parentReport: {
key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT}${report ? report.parentReportID : '0'}`,
},
policy: {
key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY}${report ? report.policyID : '0'}`,
},
parentReportActions: {
key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report ? report.parentReportID : '0'}`,
canEvict: false,
},
})(memo(AttachmentModal));
export type {Attachment, FileObject, ImagePickerResponse};