Skip to content

Commit d71feae

Browse files
authored
fix(authenticator-react-native): password manager autofill validation (#6716)
* fix(authenticator-react-native): password manager autofill validation * Add change set
1 parent 492d9d7 commit d71feae

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.changeset/young-avocados-talk.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@aws-amplify/ui-react-native': patch
3+
---
4+
5+
fix(authenticator-react-native): password manager autofill validation

packages/react-native/src/Authenticator/hooks/useFieldValues/useFieldValues.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,18 @@ export default function useFieldValues<FieldType extends TypedField>({
112112
const { name, label, labelHidden, ...rest } = field;
113113

114114
const onBlur: TextFieldOnBlur = (event) => {
115+
const textValue = values[name] || event?.nativeEvent?.text;
115116
setTouched({ ...touched, [name]: true });
116117

117118
// call `onBlur` passed as text `field` option
118119
field.onBlur?.(event);
119120

120121
// call machine blur handler
121-
handleBlur({ name, value: values[name] });
122+
handleBlur({ name, value: textValue });
122123

123124
setFieldValidationErrors({
124125
...fieldValidationErrors,
125-
[name]: runFieldValidation(field, values[name], validationErrors),
126+
[name]: runFieldValidation(field, textValue, validationErrors),
126127
});
127128
};
128129

0 commit comments

Comments
 (0)