11import React from 'react'
22import PropTypes from 'prop-types'
3- import {
4- FormControl ,
5- FormArray ,
6- FormGroup
7- } from './model'
3+ import { FormControl , FormArray , FormGroup } from './model'
84import configureControl from './configureControl'
95import Field from './Field'
10-
116export default class FieldControl extends React . Component {
127 constructor ( props , context ) {
138 super ( props , context )
149 this . control = configureControl ( props , context , 'FormControl' )
1510 }
1611 componentWillReceiveProps ( nextProps ) {
17- const {
18- name
19- } = nextProps
12+ const { name } = nextProps
2013 if ( this . props . name !== name ) {
2114 this . control = configureControl ( nextProps , this . context , 'FormControl' )
2215 }
2316 }
2417 render ( ) {
25- const {
26- strict,
27- children,
28- render
29- } = this . props
18+ const { strict, children, render, meta } = this . props
19+ if ( this . control ) {
20+ this . control . meta = meta || { }
21+ }
3022 const FieldProps = {
3123 control : this . control ,
3224 strict,
@@ -67,11 +59,12 @@ FieldControl.propTypes = {
6759 parent : PropTypes . oneOfType ( [
6860 PropTypes . instanceOf ( FormArray ) ,
6961 PropTypes . instanceOf ( FormGroup )
70- ] )
62+ ] ) ,
63+ meta : PropTypes . object
7164}
7265FieldControl . contextTypes = {
7366 parentControl : PropTypes . oneOfType ( [
7467 PropTypes . instanceOf ( FormArray ) ,
7568 PropTypes . instanceOf ( FormGroup )
7669 ] )
77- }
70+ }
0 commit comments