-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20167 from kidroca/kidroca/feat/attachment-modal-…
…route Report Attachments Modal Route
- Loading branch information
Showing
9 changed files
with
108 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from 'react'; | ||
import _ from 'underscore'; | ||
import PropTypes from 'prop-types'; | ||
import AttachmentModal from '../../../components/AttachmentModal'; | ||
import Navigation from '../../../libs/Navigation/Navigation'; | ||
import * as ReportUtils from '../../../libs/ReportUtils'; | ||
|
||
const propTypes = { | ||
/** Navigation route context info provided by react navigation */ | ||
route: PropTypes.shape({ | ||
/** Route specific parameters used on this screen */ | ||
params: PropTypes.shape({ | ||
/** The report ID which the attachment is associated with */ | ||
reportID: PropTypes.string.isRequired, | ||
/** The uri encoded source of the attachment */ | ||
source: PropTypes.string.isRequired, | ||
}).isRequired, | ||
}).isRequired, | ||
}; | ||
|
||
function ReportAttachments(props) { | ||
const reportID = _.get(props, ['route', 'params', 'reportID']); | ||
const report = ReportUtils.getReport(reportID); | ||
const source = decodeURI(_.get(props, ['route', 'params', 'source'])); | ||
|
||
return ( | ||
<AttachmentModal | ||
allowDownload | ||
defaultOpen | ||
report={report} | ||
source={source} | ||
onModalHide={() => Navigation.dismissModal(reportID)} | ||
/> | ||
); | ||
} | ||
|
||
ReportAttachments.propTypes = propTypes; | ||
ReportAttachments.displayName = 'ReportAttachments'; | ||
|
||
export default ReportAttachments; |