Releases: jaredpalmer/formik
Release list
v0.8.6
Bugfix:
- #100 Fixes double invocation of custom validate methods
v0.8.5
- Make sure
statusis reset when callingresetForm
v0.8.3
Patch Release:
- Don't use
Object.valuesto compute thedirtyprop.
v0.8.2
Patch Release
- #76 Fixes bug in hoist statics
v0.8.0
tl;dr
- No breaking changes, but a few deprecation warnings.
- New names for some imperative setters
validationSchemaand Yup are now 100% optional- New
validatemethod can handle sync and async custom validators - More control over when validation is run
Deprecations (console warnings right now) 🗑
- Deprecate
handleChangeValue. UsesetFieldValueinstead. - Deprecate
mapValuesToPayload. Move your function to the top ofhandleSubmit. - Deprecate
setErrorescape hatch with warning. UsesetStatus(it's identical and a better name IMHO).
New props and helpers 🍹 ⭐️ 🎉
setFieldValue: same ashandleChangeValue()except it does not touch the field. CallsetFieldTouchedright after if you need tosetFieldTouched: parallel tosetFieldValue, but fortouchedsetFieldError:...yeah same thing but forerrorssubmitForm: () => void;which lets you submit your form without a dom event (very useful for testing). s/o @ctrlplusb for seeing this as missing way before I did.dirty: booleanas computed prop.trueif anything has been touched.status?: any&setStatus: (status: any) => voidAn escape hatch helper for when you need to set arbitrary state (like a success behavior)
New Formik configuration options ⚙️
-
validate?: (values: Values, props: Props) => { [field: string]: string } | Promise<any>Optional custom validation option. Either return anerrorsobject or and Promise that throws anerrorobject. -
validateOnChange?: boolean = false. Will fire off validation on change events. -
validateOnBlur?: boolean = true. Will fire off validation on blur events. -
moar tests! (like a lot lot lot more)
-
validationSchemais now optional.
Even more badass TypeScript support 🎉
See #74 for details.
I added type safety to all the new setters by restricting their respective keys to Values by using mapped types. As a result, instead of being able to set arbitrary keys on errors and touched, all the setters will now get angry if field(s) are not found in your Values interface.
Old
interface FormikValues {
[field: string]: any;
}
interface FormikErrors {
[field: string]: string;
}
interface FormikTouched {
[field: string]: boolean;
}New
export interface FormikValues {
[field: string]: any;
}
export type FormikErrors<Values extends FormikValues> = {
[Key in keyof Values]?: string
};
export type FormikTouched<Values extends FormikValues> = {
[Key in keyof Values]?: boolean
};-Jared
v0.7.2
Patch Release
- #48 BUGFIX: ensure that handleBlur doesn't clobber entire touched state
v0.7.1
- Updated docs
- Works with React 14, 15, and 16-alpha
- Works with React Native (
react-domis no longer apeerDependency)
v0.7.0
Changed Formik to a named export.
Old:
import Formik from 'formik';New
import { Formik } from 'formik';v0.6.1
- Drop defaults in generic types, NEW TypeScript Signatures:
Formik<Props, Values, Payload>InjectedFormikProps<Props, Values>FormikBag<Props, Values>
v0.6.0
displayNameis now optional. Formik will now showup asFormik(<ComponentName>)in React DevTools- Non-React static class properties of inner components are now preserved
- Dropped
recompose - TypeScript improvements:
FormikBag<Props>has becomeFormikBag<Props,Values>InjectedFormikProps<Props>is the same asInjectedFormikProps<Props, Props>