Skip to content

Commit

Permalink
Merge pull request #30481 from Expensify/youssef_fix_attachments
Browse files Browse the repository at this point in the history
[CP Staging] Fix viewing attachments

(cherry picked from commit 853d489)
  • Loading branch information
tgolen authored and OSBotify committed Oct 27, 2023
1 parent 579415f commit d58a615
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/pages/home/report/ReportAttachments.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {useCallback} from 'react';
import _ from 'underscore';
import PropTypes from 'prop-types';
import AttachmentModal from '../../../components/AttachmentModal';
Expand All @@ -24,17 +24,22 @@ function ReportAttachments(props) {
const report = ReportUtils.getReport(reportID);
const source = decodeURI(_.get(props, ['route', 'params', 'source']));

const onCarouselAttachmentChange = useCallback(
(attachment) => {
const route = ROUTES.REPORT_ATTACHMENTS.getRoute(reportID, attachment.source);
Navigation.navigate(route);
},
[reportID],
);

return (
<AttachmentModal
allowDownload
defaultOpen
report={report}
source={source}
onModalHide={() => Navigation.dismissModal()}
onCarouselAttachmentChange={(attachment) => {
const route = ROUTES.REPORT_ATTACHMENTS.getRoute(reportID, attachment.source);
Navigation.navigate(route);
}}
onCarouselAttachmentChange={onCarouselAttachmentChange}
/>
);
}
Expand Down

0 comments on commit d58a615

Please sign in to comment.