Skip to content

Commit

Permalink
Merge pull request #33360 from software-mansion-labs/form-migration/r…
Browse files Browse the repository at this point in the history
…emove-old-form-component

[Form Provider Refactor] BaseGetPhysicalCard
  • Loading branch information
luacmartins authored Jan 8, 2024
2 parents a9f541d + f0f3467 commit 5aaeca1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/CheckboxWithLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,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 @@ -4,6 +4,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

0 comments on commit 5aaeca1

Please sign in to comment.