@@ -2,13 +2,7 @@ import React from 'react';
22import Button from './Button' ;
33import FormGroup from './FormGroup' ;
44import InputBase from './InputBase' ;
5-
6- function valueValidation ( { children, value} , propName , componentName ) {
7- if ( children && value ) {
8- return new Error ( 'Both value and children cannot be passed to ButtonInput' ) ;
9- }
10- return React . PropTypes . oneOfType ( [ React . PropTypes . string , React . PropTypes . number ] ) . call ( null , { children, value} , propName , componentName ) ;
11- }
5+ import childrenValueValidation from './utils/childrenValueInputValidation' ;
126
137class ButtonInput extends InputBase {
148 renderFormGroup ( children ) {
@@ -23,18 +17,20 @@ class ButtonInput extends InputBase {
2317 }
2418}
2519
20+ ButtonInput . types = [ 'button' , 'reset' , 'submit' ] ;
21+
2622ButtonInput . defaultProps = {
2723 type : 'button'
2824} ;
2925
3026ButtonInput . propTypes = {
31- type : React . PropTypes . oneOf ( [ 'button' , 'reset' , 'submit' ] ) ,
27+ type : React . PropTypes . oneOf ( ButtonInput . types ) ,
3228 bsStyle ( props ) {
3329 //defer to Button propTypes of bsStyle
3430 return null ;
3531 } ,
36- children : valueValidation ,
37- value : valueValidation
32+ children : childrenValueValidation ,
33+ value : childrenValueValidation
3834} ;
3935
4036export default ButtonInput ;
0 commit comments