diff --git a/src/components/DatePicker/index.android.js b/src/components/DatePicker/index.android.js index 77d7bbc705a2..813bf517d08b 100644 --- a/src/components/DatePicker/index.android.js +++ b/src/components/DatePicker/index.android.js @@ -39,7 +39,7 @@ class DatePicker extends React.Component { } render() { - const dateAsText = this.props.defaultValue ? moment(this.props.defaultValue).format(CONST.DATE.MOMENT_FORMAT_STRING) : ''; + const dateAsText = this.props.value || this.props.defaultValue ? moment(this.props.value || this.props.defaultValue).format(CONST.DATE.MOMENT_FORMAT_STRING) : ''; return ( <> @@ -62,7 +62,7 @@ class DatePicker extends React.Component { /> {this.state.isPickerVisible && ( this.clearErrorAndSetBeneficialOwnerValues(index, values)} values={{ diff --git a/src/pages/ReimbursementAccount/IdentityForm.js b/src/pages/ReimbursementAccount/IdentityForm.js index 7925133bbf1e..1c06061a44cb 100644 --- a/src/pages/ReimbursementAccount/IdentityForm.js +++ b/src/pages/ReimbursementAccount/IdentityForm.js @@ -1,9 +1,9 @@ import React from 'react'; import {View} from 'react-native'; import PropTypes from 'prop-types'; +import _ from 'underscore'; import TextInput from '../../components/TextInput'; import styles from '../../styles/styles'; -import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; import CONST from '../../CONST'; import DatePicker from '../../components/DatePicker'; import AddressForm from './AddressForm'; @@ -13,7 +13,7 @@ const propTypes = { style: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]), /** Callback fired when a field changes. Passes args as {[fieldName]: val} */ - onFieldChange: PropTypes.func.isRequired, + onFieldChange: PropTypes.func, /** Form values */ values: PropTypes.shape({ @@ -45,12 +45,39 @@ const propTypes = { /** Any errors that can arise from form validation */ errors: PropTypes.objectOf(PropTypes.bool), - ...withLocalizePropTypes, + /** The map for inputID of the inputs */ + inputKeys: PropTypes.shape({ + firstName: PropTypes.string, + lastName: PropTypes.string, + dob: PropTypes.string, + ssnLast4: PropTypes.string, + street: PropTypes.string, + city: PropTypes.string, + state: PropTypes.string, + zipCode: PropTypes.string, + }), + + /** Saves a draft of the input value when used in a form */ + shouldSaveDraft: PropTypes.bool, + + /** Returns translated string for given locale and phrase */ + translate: PropTypes.func.isRequired, }; const defaultProps = { style: {}, values: { + firstName: undefined, + lastName: undefined, + street: undefined, + city: undefined, + state: undefined, + zipCode: undefined, + dob: undefined, + ssnLast4: undefined, + }, + errors: {}, + inputKeys: { firstName: '', lastName: '', street: '', @@ -60,7 +87,8 @@ const defaultProps = { dob: '', ssnLast4: '', }, - errors: {}, + shouldSaveDraft: false, + onFieldChange: () => {}, }; const IdentityForm = (props) => { @@ -73,6 +101,8 @@ const IdentityForm = (props) => { props.onFieldChange({firstName: value})} @@ -81,6 +111,8 @@ const IdentityForm = (props) => { props.onFieldChange({lastName: value})} @@ -89,6 +121,8 @@ const IdentityForm = (props) => { { maximumDate={new Date()} /> { maxLength={CONST.BANK_ACCOUNT.MAX_LENGTH.SSN} /> { IdentityForm.propTypes = propTypes; IdentityForm.defaultProps = defaultProps; IdentityForm.displayName = 'IdentityForm'; -export default withLocalize(IdentityForm); +export default IdentityForm; diff --git a/src/pages/ReimbursementAccount/RequestorStep.js b/src/pages/ReimbursementAccount/RequestorStep.js index 70e00a46b96e..05fc624d61be 100644 --- a/src/pages/ReimbursementAccount/RequestorStep.js +++ b/src/pages/ReimbursementAccount/RequestorStep.js @@ -221,6 +221,7 @@ class RequestorStep extends React.Component { ssnLast4: this.state.ssnLast4, }} errors={this.props.reimbursementAccount.errorFields} + translate={this.props.translate} />