Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hint inconsistent zipcode format #17144

Merged
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,8 @@ export default {
areYouSure: 'Are you sure?',
verify: 'Verify',
yesContinue: 'Yes, continue',
zipCodeExample: 'e.g. 12345, 12345-1234, 12345 1234',
websiteExample: 'e.g. https://www.expensify.com',
format: ({zipSampleFormat}) => (zipSampleFormat ? `Format: ${zipSampleFormat}` : ''),
zipCodeExampleFormat: ({zipSampleFormat}) => (zipSampleFormat ? `e.g. ${zipSampleFormat}` : ''),
},
attachmentPicker: {
cameraPermissionRequired: 'Camera access',
Expand Down
3 changes: 1 addition & 2 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ export default {
areYouSure: '¿Estás seguro?',
verify: 'Verifique',
yesContinue: 'Sí, Continuar',
zipCodeExample: 'p. ej. 12345, 12345-1234, 12345 1234',
websiteExample: 'p. ej. https://www.expensify.com',
format: ({zipSampleFormat}) => (zipSampleFormat ? `Formato: ${zipSampleFormat}` : ''),
zipCodeExampleFormat: ({zipSampleFormat}) => (zipSampleFormat ? `p. ej. ${zipSampleFormat}` : ''),
},
attachmentPicker: {
cameraPermissionRequired: 'Permiso para acceder a la cámara',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ReimbursementAccount/AddressForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const AddressForm = props => (
onChangeText={value => props.onFieldChange({zipCode: value})}
errorText={props.errors.zipCode ? props.translate('bankAccount.error.zipCode') : ''}
maxLength={CONST.BANK_ACCOUNT.MAX_LENGTH.ZIP_CODE}
hint={props.translate('common.zipCodeExample')}
hint={props.translate('common.zipCodeExampleFormat', {zipSampleFormat: CONST.COUNTRY_ZIP_REGEX_DATA.US.samples})}
/>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/Payments/AddDebitCardPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class DebitCardPage extends Component {
label={this.props.translate('common.zip')}
keyboardType={CONST.KEYBOARD_TYPE.NUMBER_PAD}
maxLength={CONST.BANK_ACCOUNT.MAX_LENGTH.ZIP_CODE}
hint={this.props.translate('common.zipCodeExample')}
hint={this.props.translate('common.zipCodeExampleFormat', {zipSampleFormat: CONST.COUNTRY_ZIP_REGEX_DATA.US.samples})}
containerStyles={[styles.mt4]}
/>
<View style={styles.mt4}>
Expand Down
9 changes: 5 additions & 4 deletions src/pages/settings/Profile/PersonalDetails/AddressPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ class AddressPage extends Component {
this.updateAddress = this.updateAddress.bind(this);
this.onCountryUpdate = this.onCountryUpdate.bind(this);

const currentCountry = lodashGet(props.privatePersonalDetails, 'address.country') || '';
const zipSampleFormat = lodashGet(CONST.COUNTRY_ZIP_REGEX_DATA, [currentCountry, 'samples'], '');
const currentCountry = lodashGet(this.props.privatePersonalDetails, 'address.country') || '';
const currentCountryISO = PersonalDetails.getCountryISO(currentCountry) || CONST.COUNTRY.US;
const zipSampleFormat = lodashGet(CONST.COUNTRY_ZIP_REGEX_DATA, [currentCountryISO, 'samples'], '');
this.state = {
isUsaForm: (currentCountry === CONST.COUNTRY.US || currentCountry === CONST.USA_COUNTRY_NAME),
zipFormat: this.props.translate('common.format', {zipSampleFormat}),
zipFormat: this.props.translate('common.zipCodeExampleFormat', {zipSampleFormat}),
};
}

Expand All @@ -75,7 +76,7 @@ class AddressPage extends Component {
const zipSampleFormat = lodashGet(CONST.COUNTRY_ZIP_REGEX_DATA, `${newCountry}.samples`, '');
this.setState({
isUsaForm: newCountry === CONST.COUNTRY.US,
zipFormat: this.props.translate('common.format', {zipSampleFormat}),
zipFormat: this.props.translate('common.zipCodeExampleFormat', {zipSampleFormat}),
});
}

Expand Down