11import React , { Component , PropTypes } from "react" ;
22
33import { getDefaultFormState } from "../../utils" ;
4- import SchemaField from "./SchemaField" ;
54
65
76class ArrayField extends Component {
@@ -65,6 +64,8 @@ class ArrayField extends Component {
6564 const { schema, uiSchema, name} = this . props ;
6665 const title = schema . title || name ;
6766 const { items} = this . state ;
67+ const SchemaField = this . context . schemaField ;
68+ console . log ( "In ArrayField, got" , SchemaField ) ;
6869 return (
6970 < fieldset
7071 className = { `field field-array field-array-of-${ schema . items . type } ` } >
@@ -80,7 +81,8 @@ class ArrayField extends Component {
8081 uiSchema = { uiSchema . items }
8182 formData = { items [ index ] }
8283 required = { this . isItemRequired ( schema . items ) }
83- onChange = { this . onChange . bind ( this , index ) } />
84+ onChange = { this . onChange . bind ( this , index ) }
85+ schemaField = { SchemaField } />
8486 < p className = "array-item-remove" >
8587 < button type = "button"
8688 onClick = { this . onDropClick . bind ( this , index ) } > -</ button > </ p >
@@ -105,4 +107,8 @@ if (process.env.NODE_ENV !== "production") {
105107 } ;
106108}
107109
110+ ArrayField . childContextTypes = {
111+ schemaField : PropTypes . oneOfType ( [ Component , Function ] )
112+ } ;
113+
108114export default ArrayField ;
0 commit comments