Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 6 additions & 4 deletions src/components/AttachmentModal.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import Str from 'expensify-common/lib/str';
import React, {memo, useCallback, useEffect, useMemo, useState} from 'react';
import {Animated, Keyboard, View} from 'react-native';
Expand Down Expand Up @@ -462,7 +463,7 @@ function AttachmentModal({
let shouldShowThreeDotsButton = false;
if (!isEmptyObject(report)) {
headerTitleNew = translate(isReceiptAttachment ? 'common.receipt' : 'common.attachment');
shouldShowDownloadButton = allowDownload && isDownloadButtonReadyToBeShown && !isReceiptAttachment && !isOffline;
shouldShowDownloadButton = allowDownload && isDownloadButtonReadyToBeShown && !shouldShowNotFoundPage && !isReceiptAttachment && !isOffline;
shouldShowThreeDotsButton = isReceiptAttachment && isModalOpen && threeDotsMenuItems.length !== 0;
}
const context = useMemo(
Expand Down Expand Up @@ -526,7 +527,8 @@ function AttachmentModal({
onLinkPress={() => Navigation.dismissModal()}
/>
)}
{!isEmptyObject(report) && !isReceiptAttachment ? (
{!shouldShowNotFoundPage && (
!isEmptyObject(report) && !isReceiptAttachment ? (
<AttachmentCarousel
accountID={accountID}
type={type}
Expand All @@ -540,7 +542,7 @@ function AttachmentModal({
!!sourceForAttachmentView &&
shouldLoadAttachment &&
!isLoading &&
!shouldShowNotFoundPage && (
(
<AttachmentCarouselPagerContext.Provider value={context}>
<AttachmentView
containerStyles={[styles.mh5]}
Expand All @@ -556,7 +558,7 @@ function AttachmentModal({
/>
</AttachmentCarouselPagerContext.Provider>
)
)}
))}
</View>
{/* If we have an onConfirm method show a confirmation button */}
{!!onConfirm && (
Expand Down
4 changes: 4 additions & 0 deletions src/pages/home/report/ReportAttachments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import type {AuthScreensParamList} from '@libs/Navigation/types';
import * as ReportUtils from '@libs/ReportUtils';
import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
import {useOnyx} from 'react-native-onyx';
import ONYXKEYS from '@src/ONYXKEYS';

type ReportAttachmentsProps = StackScreenProps<AuthScreensParamList, typeof SCREENS.ATTACHMENTS>;

Expand All @@ -16,6 +18,7 @@ function ReportAttachments({route}: ReportAttachmentsProps) {
const type = route.params.type;
const accountID = route.params.accountID;
const report = ReportUtils.getReport(reportID);
const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP)

// In native the imported images sources are of type number. Ref: https://reactnative.dev/docs/image#imagesource
const source = Number(route.params.source) || route.params.source;
Expand All @@ -42,6 +45,7 @@ function ReportAttachments({route}: ReportAttachmentsProps) {
ComposerFocusManager.setReadyToFocus();
}}
onCarouselAttachmentChange={onCarouselAttachmentChange}
shouldShowNotFoundPage={!isLoadingApp && !report?.reportID}
/>
);
}
Expand Down