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

[Form Provider Refactor] BaseGetPhysicalCard #33360

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
2 changes: 1 addition & 1 deletion src/components/CheckboxWithLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type CheckboxWithLabelProps = RequiredLabelProps & {
/** Error text to display */
errorText?: string;

/** Value for checkbox. This prop is intended to be set by Form.js only */
/** Value for checkbox. This prop is intended to be set by FormProvider only */
value?: boolean;

/** The default value for the checkbox */
Expand Down
4 changes: 2 additions & 2 deletions src/pages/EnablePayments/AdditionalDetailsStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function AdditionalDetailsStep({walletAdditionalDetails, translate, currentUserP
const shouldAskForFullSSN = walletAdditionalDetails.errorCode === CONST.WALLET.ERROR.SSN;

/**
* @param {Object} values The values object is passed from Form.js and contains info for each form element that has an inputID
* @param {Object} values The values object is passed from FormProvider and contains info for each form element that has an inputID
* @returns {Object}
*/
const validate = (values) => {
Expand Down Expand Up @@ -128,7 +128,7 @@ function AdditionalDetailsStep({walletAdditionalDetails, translate, currentUserP
};

/**
* @param {Object} values The values object is passed from Form.js and contains info for each form element that has an inputID
* @param {Object} values The values object is passed from FormProvider and contains info for each form element that has an inputID
*/
const activateWallet = (values) => {
const personalDetails = {
Expand Down
6 changes: 3 additions & 3 deletions src/pages/settings/Wallet/Card/BaseGetPhysicalCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, {useCallback, useEffect, useRef} from 'react';
import {Text} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import Form from '@components/Form';
import FormProvider from '@components/Form/FormProvider';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import ScreenWrapper from '@components/ScreenWrapper';
import useThemeStyles from '@hooks/useThemeStyles';
Expand Down Expand Up @@ -114,7 +114,7 @@ const defaultProps = {
loginList: {},
isConfirmation: false,
renderContent: (onSubmit, submitButtonText, styles, children = () => {}, onValidate = () => ({})) => (
<Form
<FormProvider
formID={ONYXKEYS.FORMS.GET_PHYSICAL_CARD_FORM}
submitButtonText={submitButtonText}
onSubmit={onSubmit}
Expand All @@ -123,7 +123,7 @@ const defaultProps = {
validate={onValidate}
>
{children}
</Form>
</FormProvider>
),
onValidate: () => ({}),
};
Expand Down
7 changes: 5 additions & 2 deletions src/pages/settings/Wallet/Card/GetPhysicalCardName.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import InputWrapper from '@components/Form/InputWrapper';
import TextInput from '@components/TextInput';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
Expand Down Expand Up @@ -72,7 +73,8 @@ function GetPhysicalCardName({
title={translate('getPhysicalCard.header')}
onValidate={onValidate}
>
<TextInput
<InputWrapper
InputComponent={TextInput}
inputID="legalFirstName"
name="legalFirstName"
label={translate('getPhysicalCard.legalFirstName')}
Expand All @@ -83,7 +85,8 @@ function GetPhysicalCardName({
containerStyles={[styles.mh5]}
shouldSaveDraft
/>
<TextInput
<InputWrapper
InputComponent={TextInput}
inputID="legalLastName"
name="legalLastName"
label={translate('getPhysicalCard.legalLastName')}
Expand Down
4 changes: 3 additions & 1 deletion src/pages/settings/Wallet/Card/GetPhysicalCardPhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import InputWrapper from '@components/Form/InputWrapper';
import TextInput from '@components/TextInput';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
Expand Down Expand Up @@ -66,7 +67,8 @@ function GetPhysicalCardPhone({
title={translate('getPhysicalCard.header')}
onValidate={onValidate}
>
<TextInput
<InputWrapper
InputComponent={TextInput}
inputID="phoneNumber"
name="phoneNumber"
label={translate('getPhysicalCard.phoneNumber')}
Expand Down
Loading