diff --git a/src/components/Form.js b/src/components/Form.js
index 116179b46d4a..415e10d71b43 100644
--- a/src/components/Form.js
+++ b/src/components/Form.js
@@ -255,6 +255,11 @@ class Form extends React.Component {
this.state.inputValues[inputID] = defaultValue;
}
+ // We force the form to set the input value from the defaultValue props if there is a saved valid value
+ if (child.props.shouldUseDefaultValue) {
+ this.state.inputValues[inputID] = child.props.defaultValue;
+ }
+
if (!_.isUndefined(child.props.value)) {
this.state.inputValues[inputID] = child.props.value;
}
diff --git a/src/components/TextInput/baseTextInputPropTypes.js b/src/components/TextInput/baseTextInputPropTypes.js
index 3fe09cfc87e4..6de484dec74d 100644
--- a/src/components/TextInput/baseTextInputPropTypes.js
+++ b/src/components/TextInput/baseTextInputPropTypes.js
@@ -76,6 +76,9 @@ const propTypes = {
/** Indicate whether pressing Enter on multiline input is allowed to submit the form. */
submitOnEnter: PropTypes.bool,
+
+ /** Set the default value to the input if there is a valid saved value */
+ shouldUseDefaultValue: PropTypes.bool,
};
const defaultProps = {
@@ -109,6 +112,7 @@ const defaultProps = {
shouldDelayFocus: false,
submitOnEnter: false,
icon: null,
+ shouldUseDefaultValue: false,
};
export {propTypes, defaultProps};
diff --git a/src/libs/ReimbursementAccountUtils.js b/src/libs/ReimbursementAccountUtils.js
deleted file mode 100644
index e8d3f3b66cf4..000000000000
--- a/src/libs/ReimbursementAccountUtils.js
+++ /dev/null
@@ -1,20 +0,0 @@
-import lodashGet from 'lodash/get';
-
-/**
- * Get the default state for input fields in the VBA flow
- *
- * @param {Object} reimbursementAccountDraft
- * @param {Object} reimbursementAccount
- * @param {String} fieldName
- * @param {*} defaultValue
- *
- * @returns {*}
- */
-function getDefaultStateForField(reimbursementAccountDraft, reimbursementAccount, fieldName, defaultValue = '') {
- return lodashGet(reimbursementAccountDraft, fieldName, lodashGet(reimbursementAccount, ['achData', fieldName], defaultValue));
-}
-
-export {
- // eslint-disable-next-line import/prefer-default-export
- getDefaultStateForField,
-};
diff --git a/src/pages/ReimbursementAccount/BankAccountManualStep.js b/src/pages/ReimbursementAccount/BankAccountManualStep.js
index 092e1b5059b8..a17f5f291d1a 100644
--- a/src/pages/ReimbursementAccount/BankAccountManualStep.js
+++ b/src/pages/ReimbursementAccount/BankAccountManualStep.js
@@ -101,6 +101,7 @@ class BankAccountManualStep extends React.Component {
keyboardType={CONST.KEYBOARD_TYPE.NUMBER_PAD}
disabled={shouldDisableInputs}
shouldSaveDraft
+ shouldUseDefaultValue={shouldDisableInputs}
/>