Skip to content

Commit 4148288

Browse files
committed
feat: fixes ssn submission bug
1 parent 6115bf6 commit 4148288

File tree

3 files changed

+23
-31
lines changed

3 files changed

+23
-31
lines changed

app/components/UI/Ramp/Deposit/Views/BasicInfo/BasicInfo.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ describe('BasicInfo Component', () => {
9999
screen.getByPlaceholderText('XXX-XX-XXXX'),
100100
'123456789',
101101
);
102+
fireEvent.changeText(screen.getByTestId('ssn-input'), '123456789');
102103
expect(screen.toJSON()).toMatchSnapshot();
103104
fireEvent.press(screen.getByRole('button', { name: 'Continue' }));
104105

app/components/UI/Ramp/Deposit/Views/BasicInfo/BasicInfo.tsx

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,17 @@ const BasicInfo = (): JSX.Element => {
135135
);
136136

137137
const handleFieldChange = useCallback(
138-
(field: keyof BasicInfoFormData, nextAction?: () => void) => (value: string) => {
139-
const currentValue = formData[field];
140-
const isAutofill = value.length - currentValue.length > 1;
138+
(field: keyof BasicInfoFormData, nextAction?: () => void) =>
139+
(value: string) => {
140+
const currentValue = formData[field];
141+
const isAutofill = value.length - currentValue.length > 1;
141142

142-
handleFormDataChange(field)(value);
143+
handleFormDataChange(field)(value);
143144

144-
if (isAutofill && nextAction) {
145-
nextAction();
146-
}
147-
},
145+
if (isAutofill && nextAction) {
146+
nextAction();
147+
}
148+
},
148149
[formData, handleFormDataChange],
149150
);
150151

@@ -166,7 +167,10 @@ const BasicInfo = (): JSX.Element => {
166167
label={strings('deposit.basic_info.first_name')}
167168
placeholder="John"
168169
value={formData.firstName}
169-
onChangeText={handleFieldChange('firstName', focusNextField(lastNameInputRef))}
170+
onChangeText={handleFieldChange(
171+
'firstName',
172+
focusNextField(lastNameInputRef),
173+
)}
170174
error={errors.firstName}
171175
returnKeyType="next"
172176
testID="first-name-input"
@@ -182,7 +186,10 @@ const BasicInfo = (): JSX.Element => {
182186
label={strings('deposit.basic_info.last_name')}
183187
placeholder="Smith"
184188
value={formData.lastName}
185-
onChangeText={handleFieldChange('lastName', focusNextField(phoneInputRef))}
189+
onChangeText={handleFieldChange(
190+
'lastName',
191+
focusNextField(phoneInputRef),
192+
)}
186193
error={errors.lastName}
187194
returnKeyType="next"
188195
testID="last-name-input"
@@ -198,7 +205,10 @@ const BasicInfo = (): JSX.Element => {
198205
<DepositPhoneField
199206
label={strings('deposit.basic_info.phone_number')}
200207
value={formData.mobileNumber}
201-
onChangeText={handleFieldChange('mobileNumber', focusNextField(dateInputRef))}
208+
onChangeText={handleFieldChange(
209+
'mobileNumber',
210+
focusNextField(dateInputRef),
211+
)}
202212
error={errors.mobileNumber}
203213
ref={phoneInputRef}
204214
onSubmitEditing={focusNextField(dateInputRef)}
@@ -232,10 +242,7 @@ const BasicInfo = (): JSX.Element => {
232242
label={strings('deposit.basic_info.social_security_number')}
233243
placeholder="XXX-XX-XXXX"
234244
value={formData.ssn}
235-
onChangeText={handleFieldChange('ssn', () => {
236-
Keyboard.dismiss();
237-
handleOnPressContinue();
238-
})}
245+
onChangeText={handleFieldChange('ssn')}
239246
error={errors.ssn}
240247
returnKeyType="done"
241248
testID="ssn-input"
@@ -247,7 +254,6 @@ const BasicInfo = (): JSX.Element => {
247254
maxLength={11}
248255
onSubmitEditing={() => {
249256
Keyboard.dismiss();
250-
handleOnPressContinue();
251257
}}
252258
/>
253259
)}

app/components/UI/Ramp/Deposit/Views/BasicInfo/__snapshots__/BasicInfo.test.tsx.snap

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,21 +1140,6 @@ exports[`BasicInfo Component navigates to address page when form is valid and co
11401140
/>
11411141
</View>
11421142
</View>
1143-
<Text
1144-
accessibilityRole="text"
1145-
style={
1146-
{
1147-
"color": "#ca3542",
1148-
"fontFamily": "Geist Regular",
1149-
"fontSize": 12,
1150-
"letterSpacing": 0,
1151-
"lineHeight": 24,
1152-
"marginTop": 4,
1153-
}
1154-
}
1155-
>
1156-
Social security number is required
1157-
</Text>
11581143
</View>
11591144
</View>
11601145
</View>

0 commit comments

Comments
 (0)