@@ -4,7 +4,6 @@ import {withOnyx} from 'react-native-onyx';
44import { format } from 'date-fns' ;
55import _ from 'underscore' ;
66import { View } from 'react-native' ;
7- import Str from 'expensify-common/lib/str' ;
87import styles from '../styles/styles' ;
98import * as ReportUtils from '../libs/ReportUtils' ;
109import * as OptionsListUtils from '../libs/OptionsListUtils' ;
@@ -26,12 +25,8 @@ import Button from './Button';
2625import * as Expensicons from './Icon/Expensicons' ;
2726import themeColors from '../styles/themes/default' ;
2827import Image from './Image' ;
29- import ReceiptHTML from '../../assets/images/receipt-html.png' ;
30- import ReceiptDoc from '../../assets/images/receipt-doc.png' ;
31- import ReceiptGeneric from '../../assets/images/receipt-generic.png' ;
32- import ReceiptSVG from '../../assets/images/receipt-svg.png' ;
33- import * as FileUtils from '../libs/fileDownload/FileUtils' ;
3428import useLocalize from '../hooks/useLocalize' ;
29+ import * as ReceiptUtils from '../libs/ReceiptUtils' ;
3530
3631const propTypes = {
3732 /** Callback to inform parent modal of success */
@@ -319,36 +314,6 @@ function MoneyRequestConfirmationList(props) {
319314 ) ;
320315 } , [ confirm , props . selectedParticipants , props . bankAccountRoute , props . iouCurrencyCode , props . iouType , props . isReadOnly , props . policyID , selectedParticipants , splitOrRequestOptions ] ) ;
321316
322- /**
323- * Grab the appropriate image URI based on file type
324- *
325- * @param {String } receiptPath
326- * @param {String } receiptSource
327- * @returns {* }
328- */
329- const getImageURI = ( receiptPath , receiptSource ) => {
330- const { fileExtension} = FileUtils . splitExtensionFromFileName ( receiptSource ) ;
331- const isReceiptImage = Str . isImage ( props . receiptSource ) ;
332-
333- if ( isReceiptImage ) {
334- return receiptPath ;
335- }
336-
337- if ( fileExtension === CONST . IOU . FILE_TYPES . HTML ) {
338- return ReceiptHTML ;
339- }
340-
341- if ( fileExtension === CONST . IOU . FILE_TYPES . DOC || fileExtension === CONST . IOU . FILE_TYPES . DOCX ) {
342- return ReceiptDoc ;
343- }
344-
345- if ( fileExtension === CONST . IOU . FILE_TYPES . SVG ) {
346- return ReceiptSVG ;
347- }
348-
349- return ReceiptGeneric ;
350- } ;
351-
352317 return (
353318 < OptionsSelector
354319 sections = { optionSelectorSections }
@@ -369,7 +334,7 @@ function MoneyRequestConfirmationList(props) {
369334 { ! _ . isEmpty ( props . receiptPath ) ? (
370335 < Image
371336 style = { styles . moneyRequestImage }
372- source = { { uri : getImageURI ( props . receiptPath , props . receiptSource ) } }
337+ source = { { uri : ReceiptUtils . getThumbnailAndImageURIs ( props . receiptPath , props . receiptSource ) . image } }
373338 />
374339 ) : (
375340 < MenuItemWithTopDescription
0 commit comments