diff --git a/src/CONST.js b/src/CONST.js index 20475dd0983c..1b0a49e36d18 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -201,7 +201,7 @@ const CONST = { DEFAULT: 'default', }, ERROR: { - API_OFFLINE: 'session.offlineMessage', + API_OFFLINE: 'session.offlineMessageRetry', }, NETWORK: { METHOD: { diff --git a/src/components/IOUConfirmationList.js b/src/components/IOUConfirmationList.js index 3c4bcefc44e4..8b46974f39ad 100755 --- a/src/components/IOUConfirmationList.js +++ b/src/components/IOUConfirmationList.js @@ -19,20 +19,12 @@ import SafeAreaInsetPropTypes from '../pages/SafeAreaInsetPropTypes'; import withWindowDimensions, {windowDimensionsPropTypes} from './withWindowDimensions'; import compose from '../libs/compose'; import FixedFooter from './FixedFooter'; +import CONST from '../CONST'; const propTypes = { /** Callback to inform parent modal of success */ onConfirm: PropTypes.func.isRequired, - // User's currency preference - selectedCurrency: PropTypes.shape({ - // Currency code for the selected currency - currencyCode: PropTypes.string, - - // Currency symbol for the selected currency - currencySymbol: PropTypes.string, - }).isRequired, - // Callback to update comment from IOUModal onUpdateComment: PropTypes.func, @@ -80,20 +72,33 @@ const propTypes = { /** Primary login of the user */ login: PropTypes.string, - }).isRequired, + }), /** Holds data related to IOU view state, rather than the underlying IOU data. */ iou: PropTypes.shape({ /** Whether or not the IOU step is loading (creating the IOU Report) */ loading: PropTypes.bool, + + // Selected Currency Code of the current IOU + selectedCurrencyCode: PropTypes.string, + }), + + /** Information about the network */ + network: PropTypes.shape({ + /** Is the network currently offline or not */ + isOffline: PropTypes.bool, }), }; const defaultProps = { - iou: {}, + iou: { + selectedCurrencyCode: CONST.CURRENCY.USD, + }, onUpdateComment: null, comment: '', + network: {}, + myPersonalDetails: {}, }; // Gives minimum height to offset the height of @@ -115,14 +120,14 @@ class IOUConfirmationList extends Component { this.props.myPersonalDetails, this.props.numberFormat(this.calculateAmount() / 100, { style: 'currency', - currency: this.props.selectedCurrency.currencyCode, + currency: this.props.iou.selectedCurrencyCode, }), ); const formattedParticipants = getIOUConfirmationOptionsFromParticipants(this.props.participants, this.props.numberFormat(this.calculateAmount() / 100, { style: 'currency', - currency: this.props.selectedCurrency.currencyCode, + currency: this.props.iou.selectedCurrencyCode, })); sections.push({ @@ -141,7 +146,7 @@ class IOUConfirmationList extends Component { const formattedParticipants = getIOUConfirmationOptionsFromParticipants(this.props.participants, this.props.numberFormat(this.props.iouAmount, { style: 'currency', - currency: this.props.selectedCurrency.currencyCode, + currency: this.props.iou.selectedCurrencyCode, })); sections.push({ @@ -237,7 +242,7 @@ class IOUConfirmationList extends Component { this.props.hasMultipleParticipants ? 'iou.split' : 'iou.request', { amount: this.props.numberFormat( this.props.iouAmount, - {style: 'currency', currency: this.props.selectedCurrency.currencyCode}, + {style: 'currency', currency: this.props.iou.selectedCurrencyCode}, ), }, ); @@ -274,10 +279,16 @@ class IOUConfirmationList extends Component { + {this.props.network.isOffline && ( + + {this.props.translate('session.offlineMessage')} + + )}