Skip to content

Commit

Permalink
Pass in error message, pre-format addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
robertjchen committed Oct 13, 2021
1 parent a7629cc commit 08a9660
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
20 changes: 19 additions & 1 deletion src/pages/ReimbursementAccount/IdentityForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,23 @@ const IdentityForm = ({
const dobErrorText = (errors.dob ? translate('bankAccount.error.dob') : '')
|| (errors.dobAge ? translate('bankAccount.error.age') : '');

const getFormattedAddressValue = () => {
let addressString = '';
if (street) {
addressString += `${street}, `;
}
if (city) {
addressString += `${city}, `;
}
if (state) {
addressString += `${state}, `;
}
if (zipCode) {
addressString += `${zipCode}`;
}
return addressString;
};

return (
<View style={style}>
<View style={[styles.flexRow]}>
Expand Down Expand Up @@ -118,8 +135,9 @@ const IdentityForm = ({
<AddressSearch
label={translate('common.personalAddress')}
containerStyles={[styles.mt4]}
value={`${street} ${city} ${state} ${zipCode}`}
value={getFormattedAddressValue()}
onChangeText={(fieldName, value) => onFieldChange(fieldName, value)}
errorText={errors.street ? translate('bankAccount.error.addressStreet') : ''}
/>
</View>
);
Expand Down
1 change: 0 additions & 1 deletion src/pages/ReimbursementAccount/RequestorStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ class RequestorStep extends React.Component {
city: 'requestorAddressCity',
state: 'requestorAddressState',
zipCode: 'requestorAddressZipCode',

addressStreet: 'requestorAddressStreet',
addressCity: 'requestorAddressCity',
addressState: 'requestorAddressState',
Expand Down

0 comments on commit 08a9660

Please sign in to comment.