diff --git a/src/libs/ValidationUtils.ts b/src/libs/ValidationUtils.ts index 9ba11fb16d6a..366201c952ce 100644 --- a/src/libs/ValidationUtils.ts +++ b/src/libs/ValidationUtils.ts @@ -87,17 +87,22 @@ function isRequiredFulfilled(value: string | Date | unknown[] | Record = {[P in K[number]]: string}; + /** * Used to add requiredField error to the fields passed. */ -function getFieldRequiredErrors(values: OnyxCommon.Errors, requiredFields: string[]) { - const errors: OnyxCommon.Errors = {}; - requiredFields.forEach((fieldKey) => { +function getFieldRequiredErrors(values: T, requiredFields: K): GetFieldRequiredErrorsReturn { + const errors: GetFieldRequiredErrorsReturn = {} as GetFieldRequiredErrorsReturn; + + requiredFields.forEach((fieldKey: K[number]) => { if (isRequiredFulfilled(values[fieldKey])) { return; } + errors[fieldKey] = 'common.error.fieldRequired'; }); + return errors; } diff --git a/src/pages/ReimbursementAccount/BeneficialOwnerInfo/substeps/CompanyOwnersListUBO.tsx b/src/pages/ReimbursementAccount/BeneficialOwnerInfo/substeps/CompanyOwnersListUBO.tsx index dbe31088b454..a944ed26f0e7 100644 --- a/src/pages/ReimbursementAccount/BeneficialOwnerInfo/substeps/CompanyOwnersListUBO.tsx +++ b/src/pages/ReimbursementAccount/BeneficialOwnerInfo/substeps/CompanyOwnersListUBO.tsx @@ -89,7 +89,7 @@ function CompanyOwnersListUBO({ key={ownerKey} title={`${beneficialOwnerData.firstName} ${beneficialOwnerData.lastName}`} description={`${beneficialOwnerData.street}, ${beneficialOwnerData.city}, ${beneficialOwnerData.state} ${beneficialOwnerData.zipCode}`} - wrapperStyle={[styles.ph0]} + wrapperStyle={[styles.ph5]} icon={Expensicons.FallbackAvatar} onPress={() => { handleUBOEdit(ownerKey); @@ -107,16 +107,16 @@ function CompanyOwnersListUBO({ testID={CompanyOwnersListUBO.displayName} style={[styles.pt0]} > - - {translate('beneficialOwnerInfoStep.letsDoubleCheck')} - {translate('beneficialOwnerInfoStep.regulationRequiresUsToVerifyTheIdentity')} + + {translate('beneficialOwnerInfoStep.letsDoubleCheck')} + {translate('beneficialOwnerInfoStep.regulationRequiresUsToVerifyTheIdentity')} - {`${translate('beneficialOwnerInfoStep.owners')}:`} + {`${translate('beneficialOwnerInfoStep.owners')}:`} {isUserUBO && ( diff --git a/src/pages/ReimbursementAccount/BusinessInfo/substeps/IncorporationStateBusiness.tsx b/src/pages/ReimbursementAccount/BusinessInfo/substeps/IncorporationStateBusiness.tsx index 12c5411acbe8..f6d0453a70e3 100644 --- a/src/pages/ReimbursementAccount/BusinessInfo/substeps/IncorporationStateBusiness.tsx +++ b/src/pages/ReimbursementAccount/BusinessInfo/substeps/IncorporationStateBusiness.tsx @@ -46,10 +46,10 @@ function IncorporationStateBusiness({reimbursementAccount, onNext, isEditing}: I submitButtonText={translate(isEditing ? 'common.confirm' : 'common.next')} validate={validate} onSubmit={handleSubmit} - style={[styles.mh5, styles.flexGrow1]} - submitButtonStyles={[styles.pb5, styles.mb0]} + style={[styles.mh0, styles.flexGrow1]} + submitButtonStyles={[styles.ph5, styles.pb5, styles.mb0]} > - {translate('businessInfoStep.pleaseSelectTheStateYourCompanyWasIncorporatedIn')} + {translate('businessInfoStep.pleaseSelectTheStateYourCompanyWasIncorporatedIn')} );