Skip to content

Commit

Permalink
fixing field touch on blur (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
eonwhite authored and jaredpalmer committed Jun 17, 2017
1 parent bb305e1 commit 3e291f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/formik.tsx
Expand Up @@ -233,8 +233,8 @@ export default function Formik<Props, Values extends FormikValues, Payload>({
e.persist();
const { name, id } = e.target;
const field = name ? name : id;
const { values } = this.state;
this.setTouched({ ...values as any, [field]: true });
const { touched } = this.state;
this.setTouched({ ...touched, [field]: true });
};

handleChangeValue = (field: string, value: any) => {
Expand Down
2 changes: 1 addition & 1 deletion src/index.tsx
Expand Up @@ -177,7 +177,7 @@ export default function Formik<Props, Values extends FormikValues, Payload>({
e.persist();
const { name, id } = e.target;
const field = name ? name : id;
setTouched({ ...values, [field]: true });
setTouched({ ...touched, [field]: true });
},
handleChangeValue: (field: string, value: any) => {
// Set changed fields as touched
Expand Down

0 comments on commit 3e291f9

Please sign in to comment.