Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
f9d1702
refactor: AttachmentCarousel, extract common UI
Swor71 May 27, 2025
21096e9
add: basic navigation setup for receipt view modal
Swor71 May 29, 2025
7b60797
add: draft ReceiptViewModal component and setup
Swor71 May 29, 2025
c246819
change: ReceiptViewModal to depend on local state instead of navigati…
Swor71 May 30, 2025
b7bafca
Merge branch 'main' into feature/multi-scan-wire-up
Swor71 May 30, 2025
f79376b
Merge remote-tracking branch 'origin/VickyStash/feature/61179-update-…
Swor71 May 30, 2025
bff82d4
chore: adjustments to slack replies, general clean up
Swor71 Jun 2, 2025
d908473
change: reintroduced navigation with params due to mobile web require…
Swor71 Jun 2, 2025
837d8f2
Merge remote-tracking branch 'origin/VickyStash/feature/61179-update-…
Swor71 Jun 3, 2025
a99a584
add: switching between images in ReceiptViewModal with arrows, delete…
Swor71 Jun 3, 2025
8e92177
chore: minor clean up
Swor71 Jun 3, 2025
54e5d52
add: native initial implementation for ReceiptViewModal
Swor71 Jun 3, 2025
a1d4440
Merge branch 'main' into feature/multi-scan-wire-up
Swor71 Jun 4, 2025
6ddc737
remove: not needed receiptID assignment
Swor71 Jun 4, 2025
6897997
add: confirmation modal on deleting receipt
Swor71 Jun 4, 2025
e28343c
chore: removed dependency on attachments from carousel buttons
Swor71 Jun 4, 2025
b602ef5
add: ReceiptViewModal independent of platform
Swor71 Jun 4, 2025
f9dfcc0
refactor: native versions of AttachmentCarousel and AttachmentCarouse…
Swor71 Jun 4, 2025
513d3b0
refactor: web versions of AttachmentCarousel and AttachmentCarouselView
Swor71 Jun 4, 2025
c5644ec
chore: clean up, extracted common types
Swor71 Jun 5, 2025
8e1635a
Merge branch 'main' into feature/multi-scan-wire-up
Swor71 Jun 5, 2025
92001ab
chore: remove comment
Swor71 Jun 5, 2025
b1be0a4
fix: eslint CI error
Swor71 Jun 5, 2025
58cd754
fix: prettier CI error
Swor71 Jun 5, 2025
1e2622f
chore: removed duplicate of AttachmentCarousel for native platform
Swor71 Jun 5, 2025
9be12a4
fix: no found page after deleting a receipt
Swor71 Jun 5, 2025
5a14e1f
revert: CarouselButtons changes
Swor71 Jun 6, 2025
7056ebc
Merge branch 'main' into feature/multi-scan-wire-up
Swor71 Jun 9, 2025
84e22c0
add: backTo param to handle correct navigation after reload
Swor71 Jun 9, 2025
ac069d7
add: check for localSource in AttachmentView
Swor71 Jun 9, 2025
b395fda
chore: moved check for local source next to if block responsible for …
Swor71 Jun 10, 2025
18670b8
Merge branch 'main' into feature/multi-scan-wire-up
Swor71 Jun 11, 2025
739020b
fix: in native modal always opening on first image
Swor71 Jun 11, 2025
0f48f9f
Merge branch 'main' into feature/multi-scan-wire-up
Swor71 Jun 11, 2025
df21be3
fix: ts error
Swor71 Jun 12, 2025
bbf5826
Merge branch 'main' into feature/multi-scan-wire-up
Swor71 Jun 12, 2025
d62c855
Merge branch 'main' into feature/multi-scan-wire-up
Swor71 Jun 12, 2025
1b20901
chore: change canUseMultiScan to true for ad hoc build
Swor71 Jun 13, 2025
8a92634
Merge branch 'main' into feature/multi-scan-wire-up
Swor71 Jun 16, 2025
af47793
fix: disabled help button in header
Swor71 Jun 16, 2025
02f44f6
Merge branch 'main' into feature/multi-scan-wire-up
Swor71 Jun 17, 2025
5395e1b
fix: double modal showing up on delete receipt press
Swor71 Jun 17, 2025
02d2171
Merge branch 'main' into feature/multi-scan-wire-up
Swor71 Jun 20, 2025
4a82a0d
Merge branch 'main' into feature/multi-scan-wire-up
Swor71 Jun 23, 2025
c3d400e
fix: icon size
Swor71 Jun 23, 2025
36c26ad
Merge branch 'main' into feature/multi-scan-wire-up
Swor71 Jun 23, 2025
066f4f4
Merge branch 'main' into feature/multi-scan-wire-up
Swor71 Jun 24, 2025
212ee5c
Merge branch 'main' into feature/multi-scan-wire-up
Swor71 Jun 24, 2025
053056a
fix: incorrect spacing for photos on ios
Swor71 Jun 25, 2025
38d0752
Revert "fix: incorrect spacing for photos on ios"
Swor71 Jun 25, 2025
ea2aab3
Merge branch 'main' into feature/multi-scan-wire-up
Swor71 Jun 25, 2025
d56ec80
Merge branch 'main' into feature/multi-scan-wire-up
Swor71 Jun 25, 2025
fbcc345
fix: lint error
Swor71 Jun 25, 2025
12e556c
Merge branch 'main' into feature/multi-scan-wire-up
Swor71 Jun 26, 2025
9d7ebfb
fix: confirm delete modal not showing up
Swor71 Jun 26, 2025
dd87582
Merge branch 'main' into feature/multi-scan-wire-up
Swor71 Jun 27, 2025
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
5 changes: 5 additions & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,11 @@ const ROUTES = {
`create/${iouType as string}/start/${transactionID}/${reportID}/per-diem/${backToReport ?? ''}` as const,
},

MONEY_REQUEST_RECEIPT_VIEW_MODAL: {
route: 'receipt-view-modal/:transactionID',
getRoute: (transactionID: string, backTo: string) => getUrlWithBackToParam(`receipt-view-modal/${transactionID}`, backTo),
} as const,

MONEY_REQUEST_STATE_SELECTOR: {
route: 'submit/state',

Expand Down
1 change: 1 addition & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ const SCREENS = {
STEP_WAYPOINT: 'Money_Request_Step_Waypoint',
STEP_TAX_AMOUNT: 'Money_Request_Step_Tax_Amount',
STEP_TAX_RATE: 'Money_Request_Step_Tax_Rate',
RECEIPT_VIEW_MODAL: 'Money_Request_Receipt_View_Modal',
STEP_SPLIT_PAYER: 'Money_Request_Step_Split_Payer',
STEP_SEND_FROM: 'Money_Request_Step_Send_From',
STEP_COMPANY_INFO: 'Money_Request_Step_Company_Info',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import React, {useCallback, useRef, useState} from 'react';
import {Keyboard, View} from 'react-native';
import CarouselButtons from '@components/Attachments/AttachmentCarousel/CarouselButtons';
import AttachmentCarouselPager from '@components/Attachments/AttachmentCarousel/Pager';
import type {AttachmentCarouselPagerHandle} from '@components/Attachments/AttachmentCarousel/Pager';
import type {AttachmentSource} from '@components/Attachments/types';
import BlockingView from '@components/BlockingViews/BlockingView';
import * as Illustrations from '@components/Icon/Illustrations';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import {canUseTouchScreen as canUseTouchScreenUtil} from '@libs/DeviceCapabilities';
import variables from '@styles/variables';
import type AttachmentCarouselViewProps from './types';

function AttachmentCarouselView({
page,
attachments,
shouldShowArrows,
source,
report,
autoHideArrows,
cancelAutoHideArrow,
setShouldShowArrows,
onAttachmentError,
onNavigate,
onClose,
setPage,
attachmentID,
}: AttachmentCarouselViewProps) {
const {translate} = useLocalize();
const canUseTouchScreen = canUseTouchScreenUtil();
const styles = useThemeStyles();
const [activeAttachmentID, setActiveAttachmentID] = useState<AttachmentSource>(attachmentID ?? source);

const pagerRef = useRef<AttachmentCarouselPagerHandle>(null);

/** Updates the page state when the user navigates between attachments */
const updatePage = useCallback(
(newPageIndex: number) => {
Keyboard.dismiss();
setShouldShowArrows(true);

const item = attachments.at(newPageIndex);

setPage(newPageIndex);
if (newPageIndex >= 0 && item) {
setActiveAttachmentID(item.attachmentID ?? item.source);
if (onNavigate) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code caused #80949: onNavigate is called twice per page change — once via the if (onNavigate) guard and again via onNavigate?.(item) on the next line. This double call causes double route navigation per swipe, destabilizing video initialization and causing the play/pause button to blink. Combined with extraneous useEffect dependencies in AttachmentView and an unstable updateCurrentURLAndReportID callback in PlaybackContext (from #81732), this created a feedback loop preventing video playback when navigating via the carousel. Fixed in #84739.

onNavigate(item);
}
onNavigate?.(item);
}
},
[setShouldShowArrows, attachments, setPage, onNavigate],
);

/**
* Increments or decrements the index to get another selected item
* @param {Number} deltaSlide
*/
const cycleThroughAttachments = useCallback(
(deltaSlide: number) => {
if (page === undefined) {
return;
}
const nextPageIndex = page + deltaSlide;
updatePage(nextPageIndex);
pagerRef.current?.setPage(nextPageIndex);

autoHideArrows();
},
[autoHideArrows, page, updatePage],
);

return (
<View
style={[styles.flex1, styles.attachmentCarouselContainer]}
onMouseEnter={() => !canUseTouchScreen && setShouldShowArrows(true)}
onMouseLeave={() => !canUseTouchScreen && setShouldShowArrows(false)}
>
{page === -1 ? (
<BlockingView
icon={Illustrations.ToddBehindCloud}
iconWidth={variables.modalTopIconWidth}
iconHeight={variables.modalTopIconHeight}
title={translate('notFound.notHere')}
/>
) : (
<>
<CarouselButtons
page={page}
attachments={attachments}
shouldShowArrows={shouldShowArrows}
onBack={() => cycleThroughAttachments(-1)}
onForward={() => cycleThroughAttachments(1)}
autoHideArrow={autoHideArrows}
cancelAutoHideArrow={cancelAutoHideArrow}
/>
<AttachmentCarouselPager
items={attachments}
initialPage={page}
onAttachmentError={onAttachmentError}
activeAttachmentID={activeAttachmentID}
setShouldShowArrows={setShouldShowArrows}
onPageSelected={({nativeEvent: {position: newPage}}) => updatePage(newPage)}
onClose={onClose}
ref={pagerRef}
reportID={report?.reportID}
/>
</>
)}
</View>
);
}

AttachmentCarouselView.displayName = 'AttachmentCarouselView';

export default AttachmentCarouselView;
Loading
Loading