@@ -6,9 +6,12 @@ import type {
66 Decorator,
77 FormState,
88 FormSubscription,
9- FieldSubscription
9+ FieldSubscription,
10+ FieldValidator
1011} from 'final-form'
1112
13+ type SupportedInputs = 'input' | 'select' | 'textarea'
14+
1215export type ReactContext = {
1316 reactFinalForm: FormApi
1417}
@@ -21,22 +24,22 @@ export type FieldRenderProps = {
2124 onFocus: (?SyntheticFocusEvent<*>) => void,
2225 value: any
2326 },
24- meta: $Shape< {
27+ meta: {
2528 // TODO: Make a diff of `FieldState` without all the functions
26- active: boolean,
27- dirty: boolean,
28- dirtySinceLastSubmit: boolean,
29- error: any,
30- initial: boolean,
31- invalid: boolean,
32- pristine: boolean,
33- submitError: any,
34- submitFailed: boolean,
35- submitSucceeded: boolean,
36- touched: boolean,
37- valid: boolean,
38- visited: boolean
39- }>
29+ active? : boolean,
30+ dirty? : boolean,
31+ dirtySinceLastSubmit? : boolean,
32+ error? : any,
33+ initial? : boolean,
34+ invalid? : boolean,
35+ pristine? : boolean,
36+ submitError? : any,
37+ submitFailed? : boolean,
38+ submitSucceeded? : boolean,
39+ touched? : boolean,
40+ valid? : boolean,
41+ visited? : boolean
42+ }
4043}
4144
4245export type SubsetFormApi = {
@@ -55,11 +58,11 @@ export type FormRenderProps = {
5558
5659export type FormSpyRenderProps = SubsetFormApi & FormState
5760
58- export type RenderableProps<T> = $Shape< {
59- children: ((props: T) => React.Node) | React.Node,
60- component: React.ComponentType<*>,
61- render: (props: T) => React.Node
62- }>
61+ export type RenderableProps<T> = {
62+ children? : ((props: T) => React.Node) | React.Node,
63+ component? : React.ComponentType<*> | string ,
64+ render? : (props: T) => React.Node
65+ }
6366
6467export type FormProps = {
6568 subscription?: FormSubscription,
@@ -69,12 +72,13 @@ export type FormProps = {
6972
7073export type FieldProps = {
7174 allowNull?: boolean,
72- format: ((value: any, name: string) => any) | null,
75+ component?: React.ComponentType<*> | SupportedInputs,
76+ format?: (value: any, name: string) => any,
7377 isEqual?: (a: any, b: any) => boolean,
7478 name: string,
75- parse: (( value: any, name: string) => any) | null ,
79+ parse? : (value: any, name: string) => any,
7680 subscription?: FieldSubscription,
77- validate?: (value: ?any, allValues: Object) => ?any ,
81+ validate?: FieldValidator ,
7882 validateFields?: string[],
7983 value?: any
8084} & RenderableProps<FieldRenderProps>
0 commit comments