Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/pages/iou/IOUModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import CONST from '../../CONST';
import KeyboardAvoidingView from '../../components/KeyboardAvoidingView';
import * as PersonalDetails from '../../libs/actions/PersonalDetails';
import ROUTES from '../../ROUTES';
import networkPropTypes from '../../components/networkPropTypes';
import {withNetwork} from '../../components/OnyxProvider';

/**
* IOU modal for requesting money and splitting bills.
Expand All @@ -50,6 +52,9 @@ const propTypes = {
localCurrencyCode: PropTypes.string,
}),

/** Information about the network */
network: networkPropTypes.isRequired,

// Holds data related to IOU view state, rather than the underlying IOU data.
iou: PropTypes.shape({
/** Whether or not transaction creation has started */
Expand Down Expand Up @@ -138,11 +143,15 @@ class IOUModal extends Component {
}

componentDidMount() {
PersonalDetails.fetchLocalCurrency();
this.fetchData();
IOU.setIOUSelectedCurrency(this.props.myPersonalDetails.localCurrencyCode);
}

componentDidUpdate(prevProps) {
if (prevProps.network.isOffline && !this.props.network.isOffline) {
this.fetchData();
}
Comment thread
marcaaron marked this conversation as resolved.

// Successfully close the modal if transaction creation has ended and there is no error
if (prevProps.iou.creatingIOUTransaction && !this.props.iou.creatingIOUTransaction && !this.props.iou.error) {
Navigation.dismissModal();
Expand Down Expand Up @@ -215,6 +224,10 @@ class IOUModal extends Component {
return this.props.translate(this.steps[currentStepIndex]) || '';
}

fetchData() {
PersonalDetails.fetchLocalCurrency();
}

/**
* Update comment whenever user enters any new text
*
Expand Down Expand Up @@ -453,6 +466,7 @@ IOUModal.defaultProps = defaultProps;

export default compose(
withLocalize,
withNetwork(),
withOnyx({
report: {
key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${lodashGet(route, 'params.reportID', '')}`,
Expand Down