Skip to content

Commit e3cfcaf

Browse files
authored
Merge pull request #75241 from dmkt9/fix/73744
2 parents 4c143fe + 562301c commit e3cfcaf

6 files changed

Lines changed: 14 additions & 3 deletions

File tree

src/components/Icon/chunks/illustrations.chunk.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import LaptopWithSecondScreenSync from '@assets/images/laptop-with-second-screen
1111
import LaptopWithSecondScreenX from '@assets/images/laptop-with-second-screen-x.svg';
1212
// Product Illustrations
1313
import TeleScope from '@assets/images/product-illustrations/telescope.svg';
14+
import ToddBehindCloud from '@assets/images/product-illustrations/todd-behind-cloud.svg';
1415
// Simple Illustrations - Core ones that are actually used
1516
import Accounting from '@assets/images/simple-illustrations/simple-illustration__accounting.svg';
1617
import BlueShield from '@assets/images/simple-illustrations/simple-illustration__blueshield.svg';
@@ -51,6 +52,7 @@ const Illustrations = {
5152
// Product Illustrations
5253
TeleScope,
5354
Telescope: TeleScope, // Alias for consistency
55+
ToddBehindCloud,
5456

5557
// Simple Illustrations
5658
Accounting,

src/pages/media/AttachmentModalScreen/AttachmentModalBaseContent/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import Button from '@components/Button';
1212
import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator';
1313
import HeaderGap from '@components/HeaderGap';
1414
import HeaderWithBackButton from '@components/HeaderWithBackButton';
15-
import * as Illustrations from '@components/Icon/Illustrations';
1615
import SafeAreaConsumer from '@components/SafeAreaConsumer';
16+
import {useMemoizedLazyIllustrations} from '@hooks/useLazyAsset';
1717
import useLocalize from '@hooks/useLocalize';
1818
import useNetwork from '@hooks/useNetwork';
1919
import useOnyx from '@hooks/useOnyx';
@@ -60,11 +60,13 @@ function AttachmentModalBaseContent({
6060
AttachmentContent,
6161
onCarouselAttachmentChange = () => {},
6262
transaction: transactionProp,
63+
shouldCloseOnSwipeDown = false,
6364
}: AttachmentModalBaseContentProps) {
6465
const styles = useThemeStyles();
6566
const {shouldUseNarrowLayout} = useResponsiveLayout();
6667
const {translate} = useLocalize();
6768
const {isOffline} = useNetwork();
69+
const illustrations = useMemoizedLazyIllustrations(['ToddBehindCloud']);
6870

6971
// This logic is used to ensure that the source is updated when the source changes and
7072
// that the initially provided source is always used as a fallback.
@@ -204,8 +206,9 @@ function AttachmentModalBaseContent({
204206
onTap: () => {},
205207
onScaleChanged: () => {},
206208
onAttachmentError: setAttachmentError,
209+
...(shouldCloseOnSwipeDown ? {onSwipeDown: onClose} : {}),
207210
}),
208-
[falseSV, sourceForAttachmentView, setAttachmentError],
211+
[falseSV, sourceForAttachmentView, setAttachmentError, shouldCloseOnSwipeDown, onClose],
209212
);
210213

211214
const shouldDisplayContent = !shouldShowNotFoundPage && !isLoading;
@@ -305,7 +308,7 @@ function AttachmentModalBaseContent({
305308
{isLoading && <FullScreenLoadingIndicator testID="attachment-loading-spinner" />}
306309
{shouldShowNotFoundPage && !isLoading && (
307310
<BlockingView
308-
icon={Illustrations.ToddBehindCloud}
311+
icon={illustrations.ToddBehindCloud}
309312
iconWidth={variables.modalTopIconWidth}
310313
iconHeight={variables.modalTopIconHeight}
311314
title={translate('notFound.notHere')}

src/pages/media/AttachmentModalScreen/AttachmentModalBaseContent/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ type AttachmentModalBaseContentProps = {
118118

119119
/** Transaction object. When provided, will be used instead of fetching from Onyx. */
120120
transaction?: OnyxEntry<OnyxTypes.Transaction>;
121+
122+
/** Allows users to swipe down to close the modal */
123+
shouldCloseOnSwipeDown?: boolean;
121124
};
122125

123126
export type {

src/pages/media/AttachmentModalScreen/routes/ProfileAvatarModalContent.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ function ProfileAvatarModalContent({navigation, route}: AttachmentModalScreenPro
5454
shouldShowNotFoundPage,
5555
maybeIcon: true,
5656
onDownloadAttachment,
57+
shouldCloseOnSwipeDown: true,
5758
}),
5859
[headerTitle, isLoading, onDownloadAttachment, originalFileName, shouldShowNotFoundPage, source],
5960
);

src/pages/media/AttachmentModalScreen/routes/WorkspaceAvatarModalContent.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ function WorkspaceAvatarModalContent({navigation, route}: AttachmentModalScreenP
3838
isWorkspaceAvatar: true,
3939
maybeIcon: true,
4040
onDownloadAttachment,
41+
shouldCloseOnSwipeDown: true,
4142
}),
4243
[headerTitle, isLoading, onDownloadAttachment, originalFileName, shouldShowNotFoundPage, source],
4344
);

src/pages/media/AttachmentModalScreen/routes/report/ReportAvatarModalContent.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ function ReportAvatarModalContent({navigation, route}: AttachmentModalScreenProp
6161
isLoading,
6262
maybeIcon: true,
6363
onDownloadAttachment,
64+
shouldCloseOnSwipeDown: true,
6465
}),
6566
[attachment, shouldShowNotFoundPage, isLoading, onDownloadAttachment],
6667
);

0 commit comments

Comments
 (0)