Skip to content
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
14 changes: 14 additions & 0 deletions src/libs/getTextInputAutocorrectProps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Returns props that suppress autocorrect, spellcheck, autocomplete, and autocapitalize
* for TextInput components.
*/
function getTextInputAutocorrectProps() {
return {
autoCorrect: false,
spellCheck: false,
autoComplete: 'off' as const,
autoCapitalize: 'none' as const,
};
}

export default getTextInputAutocorrectProps;
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import useReimbursementAccountStepFormSubmit from '@hooks/useReimbursementAccountStepFormSubmit';
import useThemeStyles from '@hooks/useThemeStyles';
import getTextInputAutocorrectProps from '@libs/getTextInputAutocorrectProps';
import type BankInfoSubStepProps from '@pages/ReimbursementAccount/NonUSD/BankInfo/types';
import {getBankInfoStepValues} from '@pages/ReimbursementAccount/NonUSD/utils/getBankInfoStepValues';
import getInputForValueSet from '@pages/ReimbursementAccount/NonUSD/utils/getInputForValueSet';
Expand Down Expand Up @@ -119,13 +120,14 @@ function AccountHolderDetails({onNext, isEditing, corpayFields}: BankInfoSubStep
);
}

const inputComponent = getInputComponent(field);
return (
<View
style={styles.mb6}
key={field.id}
>
<InputWrapper
InputComponent={getInputComponent(field)}
InputComponent={inputComponent}
inputID={field.id}
label={field.label}
aria-label={field.label}
Expand All @@ -139,6 +141,7 @@ function AccountHolderDetails({onNext, isEditing, corpayFields}: BankInfoSubStep
}}
hint={field.id === ACCOUNT_HOLDER_NAME ? translate('bankInfoStep.accountHolderNameDescription') : undefined}
forwardedFSClass={CONST.FULLSTORY.CLASS.MASK}
{...(inputComponent === TextInput ? getTextInputAutocorrectProps() : {})}
/>
</View>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import useReimbursementAccountStepFormSubmit from '@hooks/useReimbursementAccountStepFormSubmit';
import useThemeStyles from '@hooks/useThemeStyles';
import getTextInputAutocorrectProps from '@libs/getTextInputAutocorrectProps';
import type {SkeletonSpanReasonAttributes} from '@libs/telemetry/useSkeletonSpan';
import type BankInfoSubStepProps from '@pages/ReimbursementAccount/NonUSD/BankInfo/types';
import {getBankInfoStepValues} from '@pages/ReimbursementAccount/NonUSD/utils/getBankInfoStepValues';
Expand Down Expand Up @@ -86,13 +87,14 @@ function BankAccountDetails({onNext, isEditing, corpayFields}: BankInfoSubStepPr
return getInputForValueSet(field, SafeString(defaultValues[field.id as keyof typeof defaultValues]), isEditing, styles);
}

const inputComponent = getInputComponent(field);
return (
<View
style={styles.mb6}
key={field.id}
>
<InputWrapper
InputComponent={getInputComponent(field)}
InputComponent={inputComponent}
inputID={field.id}
label={field.label}
aria-label={field.label}
Expand All @@ -106,6 +108,7 @@ function BankAccountDetails({onNext, isEditing, corpayFields}: BankInfoSubStepPr
country: '',
}}
forwardedFSClass={CONST.FULLSTORY.CLASS.MASK}
{...(inputComponent === TextInput ? getTextInputAutocorrectProps() : {})}
/>
</View>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import ValuePicker from '@components/ValuePicker';
import useInternationalBankAccountFormSubmit from '@hooks/useInternationalBankAccountFormSubmit';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import getTextInputAutocorrectProps from '@libs/getTextInputAutocorrectProps';
import type CustomSubPageProps from '@pages/settings/Wallet/InternationalDepositAccount/types';
import {getValidationErrors} from '@pages/settings/Wallet/InternationalDepositAccount/utils';
import Text from '@src/components/Text';
Expand Down Expand Up @@ -91,36 +92,40 @@ function AccountHolderInformation({isEditing, onNext, formValues, fieldsMap}: Cu
<Text style={[styles.textHeadlineLineHeightXXL, styles.mb6]}>{translate('addPersonalBankAccount.accountHolderInformationStepHeader')}</Text>
{Object.values(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.ACCOUNT_HOLDER_DETAILS] ?? {})
.sort((a, b) => CONST.CORPAY_FIELDS.ACCOUNT_HOLDER_FIELDS.indexOf(a.id) - CONST.CORPAY_FIELDS.ACCOUNT_HOLDER_FIELDS.indexOf(b.id))
.map((field, index) => (
<View
style={getStyle(field, index)}
key={field.id}
>
<InputWrapper
InputComponent={getInputComponent(field)}
inputID={field.id}
defaultValue={formValues[field.id]}
label={field.label + (field.isRequired ? '' : ` (${translate('common.optional')})`)}
description={field.id === CONST.CORPAY_FIELDS.ACCOUNT_HOLDER_COUNTRY_KEY ? field.label : undefined}
items={getItems(field)}
shouldAllowChange={field.id === CONST.CORPAY_FIELDS.ACCOUNT_HOLDER_COUNTRY_KEY ? false : undefined}
optionsList={field.id === CONST.CORPAY_FIELDS.ACCOUNT_HOLDER_COUNTRY_KEY ? CONST.ALL_COUNTRIES : undefined}
value={field.id === CONST.CORPAY_FIELDS.ACCOUNT_HOLDER_COUNTRY_KEY ? formValues.bankCountry : undefined}
shouldSaveDraft={!isEditing}
renamedInputKeys={{
street: isEmptyObject(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.ACCOUNT_HOLDER_DETAILS]?.accountHolderAddress1) ? '' : 'accountHolderAddress1',
street2: isEmptyObject(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.ACCOUNT_HOLDER_DETAILS]?.accountHolderAddress2) ? '' : 'accountHolderAddress2',
city: isEmptyObject(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.ACCOUNT_HOLDER_DETAILS]?.accountHolderCity) ? '' : 'accountHolderCity',
state: '',
zipCode: isEmptyObject(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.ACCOUNT_HOLDER_DETAILS]?.accountHolderPostal) ? '' : 'accountHolderPostal',
country: '',
lat: '',
lng: '',
}}
forwardedFSClass={CONST.FULLSTORY.CLASS.MASK}
/>
</View>
))}
.map((field, index) => {
const inputComponent = getInputComponent(field);
return (
<View
style={getStyle(field, index)}
key={field.id}
>
<InputWrapper
InputComponent={inputComponent}
inputID={field.id}
defaultValue={formValues[field.id]}
label={field.label + (field.isRequired ? '' : ` (${translate('common.optional')})`)}
description={field.id === CONST.CORPAY_FIELDS.ACCOUNT_HOLDER_COUNTRY_KEY ? field.label : undefined}
items={getItems(field)}
shouldAllowChange={field.id === CONST.CORPAY_FIELDS.ACCOUNT_HOLDER_COUNTRY_KEY ? false : undefined}
optionsList={field.id === CONST.CORPAY_FIELDS.ACCOUNT_HOLDER_COUNTRY_KEY ? CONST.ALL_COUNTRIES : undefined}
value={field.id === CONST.CORPAY_FIELDS.ACCOUNT_HOLDER_COUNTRY_KEY ? formValues.bankCountry : undefined}
shouldSaveDraft={!isEditing}
renamedInputKeys={{
street: isEmptyObject(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.ACCOUNT_HOLDER_DETAILS]?.accountHolderAddress1) ? '' : 'accountHolderAddress1',
street2: isEmptyObject(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.ACCOUNT_HOLDER_DETAILS]?.accountHolderAddress2) ? '' : 'accountHolderAddress2',
city: isEmptyObject(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.ACCOUNT_HOLDER_DETAILS]?.accountHolderCity) ? '' : 'accountHolderCity',
state: '',
zipCode: isEmptyObject(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.ACCOUNT_HOLDER_DETAILS]?.accountHolderPostal) ? '' : 'accountHolderPostal',
country: '',
lat: '',
lng: '',
}}
forwardedFSClass={CONST.FULLSTORY.CLASS.MASK}
{...(inputComponent === TextInput ? getTextInputAutocorrectProps() : {})}
/>
</View>
);
})}
</View>
</FormProvider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import getTextInputAutocorrectProps from '@libs/getTextInputAutocorrectProps';
import type CustomSubPageProps from '@pages/settings/Wallet/InternationalDepositAccount/types';
import {getValidationErrors} from '@pages/settings/Wallet/InternationalDepositAccount/utils';
import {fetchCorpayFields} from '@userActions/BankAccounts';
Expand Down Expand Up @@ -81,22 +82,26 @@ function BankAccountDetails({isEditing, onNext, onMove, formValues, fieldsMap}:
shouldShowFullPageOfflineView
/>
</View>
{Object.values(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.ACCOUNT_DETAILS] ?? {}).map((field) => (
<View
style={(field.valueSet ?? []).length > 0 ? [styles.mhn5, styles.pv1] : [styles.pv2]}
key={field.id}
>
<InputWrapper
InputComponent={(field.valueSet ?? []).length > 0 ? ValuePicker : TextInput}
inputID={field.id}
defaultValue={formValues[field.id]}
label={field.label + (field.isRequired ? '' : ` (${translate('common.optional')})`)}
items={(field.valueSet ?? []).map(({id, text}) => ({value: id, label: text}))}
shouldSaveDraft={!isEditing}
forwardedFSClass={CONST.FULLSTORY.CLASS.MASK}
/>
</View>
))}
{Object.values(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.ACCOUNT_DETAILS] ?? {}).map((field) => {
const isValuePicker = (field.valueSet ?? []).length > 0;
return (
<View
style={isValuePicker ? [styles.mhn5, styles.pv1] : [styles.pv2]}
key={field.id}
>
<InputWrapper
InputComponent={isValuePicker ? ValuePicker : TextInput}
inputID={field.id}
defaultValue={formValues[field.id]}
label={field.label + (field.isRequired ? '' : ` (${translate('common.optional')})`)}
items={(field.valueSet ?? []).map(({id, text}) => ({value: id, label: text}))}
shouldSaveDraft={!isEditing}
forwardedFSClass={CONST.FULLSTORY.CLASS.MASK}
{...(isValuePicker ? {} : getTextInputAutocorrectProps())}
/>
</View>
);
})}
<View style={[styles.flexRow, styles.alignItemsCenter, styles.mt4]}>
<Icon
src={icons.QuestionMark}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ValuePicker from '@components/ValuePicker';
import useInternationalBankAccountFormSubmit from '@hooks/useInternationalBankAccountFormSubmit';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import getTextInputAutocorrectProps from '@libs/getTextInputAutocorrectProps';
import type CustomSubPageProps from '@pages/settings/Wallet/InternationalDepositAccount/types';
import {getValidationErrors} from '@pages/settings/Wallet/InternationalDepositAccount/utils';
import Text from '@src/components/Text';
Expand Down Expand Up @@ -84,32 +85,36 @@ function BankInformation({isEditing, onNext, formValues, fieldsMap}: CustomSubPa
<Text style={[styles.textHeadlineLineHeightXXL, styles.mb6]}>{translate('addPersonalBankAccount.bankInformationStepHeader')}</Text>
{Object.values(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.BANK_INFORMATION] ?? {})
.sort((a, b) => CONST.CORPAY_FIELDS.BANK_INFORMATION_FIELDS.indexOf(a.id) - CONST.CORPAY_FIELDS.BANK_INFORMATION_FIELDS.indexOf(b.id))
.map((field, index) => (
<View
style={getStyle(field, index)}
key={field.id}
>
<InputWrapper
InputComponent={getInputComponent(field)}
inputID={field.id}
defaultValue={formValues[field.id]}
label={field.label + (field.isRequired ? '' : ` (${translate('common.optional')})`)}
items={getItems(field)}
shouldSaveDraft={!isEditing}
renamedInputKeys={{
street: isEmptyObject(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.BANK_INFORMATION]?.bankAddressLine1) ? '' : 'bankAddressLine1',
street2: isEmptyObject(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.BANK_INFORMATION]?.bankAddressLine2) ? '' : 'bankAddressLine2',
city: isEmptyObject(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.BANK_INFORMATION]?.bankCity) ? '' : 'bankCity',
state: '',
zipCode: isEmptyObject(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.BANK_INFORMATION]?.bankPostal) ? '' : 'bankPostal',
country: '',
lat: '',
lng: '',
}}
forwardedFSClass={CONST.FULLSTORY.CLASS.MASK}
/>
</View>
))}
.map((field, index) => {
const inputComponent = getInputComponent(field);
return (
<View
style={getStyle(field, index)}
key={field.id}
>
<InputWrapper
InputComponent={inputComponent}
inputID={field.id}
defaultValue={formValues[field.id]}
label={field.label + (field.isRequired ? '' : ` (${translate('common.optional')})`)}
items={getItems(field)}
shouldSaveDraft={!isEditing}
renamedInputKeys={{
street: isEmptyObject(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.BANK_INFORMATION]?.bankAddressLine1) ? '' : 'bankAddressLine1',
street2: isEmptyObject(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.BANK_INFORMATION]?.bankAddressLine2) ? '' : 'bankAddressLine2',
city: isEmptyObject(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.BANK_INFORMATION]?.bankCity) ? '' : 'bankCity',
state: '',
zipCode: isEmptyObject(fieldsMap[CONST.CORPAY_FIELDS.PAGE_NAME.BANK_INFORMATION]?.bankPostal) ? '' : 'bankPostal',
country: '',
lat: '',
lng: '',
}}
forwardedFSClass={CONST.FULLSTORY.CLASS.MASK}
{...(inputComponent === TextInput ? getTextInputAutocorrectProps() : {})}
/>
</View>
);
})}
</View>
</FormProvider>
);
Expand Down
Loading