diff --git a/src/components/ReportActionItem/IOUPreview.js b/src/components/ReportActionItem/IOUPreview.js index c8e40e636b58..ceec76c279c6 100644 --- a/src/components/ReportActionItem/IOUPreview.js +++ b/src/components/ReportActionItem/IOUPreview.js @@ -1,7 +1,6 @@ import React from 'react'; import { View, - ActivityIndicator, TouchableWithoutFeedback, } from 'react-native'; import PropTypes from 'prop-types'; @@ -34,6 +33,7 @@ const propTypes = { onPayButtonPressed: PropTypes.func, /** The active IOUReport, used for Onyx subscription */ + // eslint-disable-next-line react/no-unused-prop-types iouReportID: PropTypes.string.isRequired, /** The associated chatReport */ @@ -117,11 +117,6 @@ const IOUPreview = (props) => { // Pay button should only be visible to the manager of the report. const isCurrentUserManager = managerEmail === sessionEmail; - const reportIsLoading = _.isEmpty(props.iouReport); - - if (reportIsLoading) { - Report.fetchIOUReportByID(props.iouReportID, props.chatReportID); - } const managerName = lodashGet(props.personalDetails, [managerEmail, 'firstName'], '') || Str.removeSMSDomain(managerEmail); @@ -137,72 +132,68 @@ const IOUPreview = (props) => { return ( - {reportIsLoading - ? - : ( - { - PaymentMethods.clearWalletTermsError(); - Report.clearIOUError(props.chatReportID); - }} - errorRowStyles={[styles.mbn1]} - > - - - - - {cachedTotal} - - {!props.iouReport.hasOutstandingIOU && ( - - - - )} + { + PaymentMethods.clearWalletTermsError(); + Report.clearIOUError(props.chatReportID); + }} + errorRowStyles={[styles.mbn1]} + > + + + + + {cachedTotal} + + {!props.iouReport.hasOutstandingIOU && ( + + - - - - - {isCurrentUserManager - ? ( - - {props.iouReport.hasOutstandingIOU - ? props.translate('iou.youowe', {owner: ownerName}) - : props.translate('iou.youpaid', {owner: ownerName})} - - ) - : ( - - {props.iouReport.hasOutstandingIOU - ? props.translate('iou.owesyou', {manager: managerName}) - : props.translate('iou.paidyou', {manager: managerName})} - - )} - {(isCurrentUserManager - && !props.shouldHidePayButton - && props.iouReport.stateNum === CONST.REPORT.STATE_NUM.PROCESSING && ( -