Remove unused child type validation

pull/10616/head
Alex P 2018-11-19 10:49:25 -08:00
parent cd0de6babb
commit 7636400022
1 changed files with 0 additions and 21 deletions

View File

@ -32,17 +32,9 @@ class Form extends Component<Props> {
FormFooter,
]
public static ValidChildNames: string = _.map(Form.ValidChildTypes, valid => {
const name = valid.displayName.split('Form').pop()
return `<Form.${name}>`
}).join(', ')
public render() {
const {children, style} = this.props
this.validateChildren()
return (
<form
style={style}
@ -66,19 +58,6 @@ class Form extends Component<Props> {
[`${className}`]: className,
})
}
private validateChildren = (): void => {
const childArray = React.Children.toArray(this.props.children)
const childrenAreValid = _.every(childArray, this.childTypeIsValid)
if (!childrenAreValid) {
// throw new Error(
// `<Form> expected children of type ${Form.ValidChildNames}`
// )
}
}
private childTypeIsValid = (child: JSX.Element): boolean =>
_.includes(Form.ValidChildTypes, child.type)
}
export default Form