File tree Expand file tree Collapse file tree 8 files changed +2814
-214
lines changed Expand file tree Collapse file tree 8 files changed +2814
-214
lines changed Original file line number Diff line number Diff line change 1
1
dist
2
+ coverage
Original file line number Diff line number Diff line change 2
2
.babelrc
3
3
form.js
4
4
README.md
5
+ circle.yml
6
+ coverage
Original file line number Diff line number Diff line change 1
1
## React Validify
2
+ [ ![ CircleCI] ( https://circleci.com/gh/navjobs/validify.svg?style=svg )] ( https://circleci.com/gh/navjobs/validify )
2
3
3
4
### Todo
4
5
Original file line number Diff line number Diff line change
1
+ machine :
2
+ node :
3
+ version : 8.2.1
Original file line number Diff line number Diff line change @@ -57,13 +57,16 @@ export default class Form extends React.Component {
57
57
renderChildren ( children ) {
58
58
return React . Children . map ( children , child => {
59
59
if ( ! child || ! child . props ) return child ;
60
+
61
+ let children = child . props . children ;
60
62
if ( child . props . children && typeof child . props . children !== 'string' )
61
- return this . renderChildren ( child . props . children ) ;
63
+ children = this . renderChildren ( child . props . children ) ;
62
64
63
65
let { values, errors } = this . state ;
64
66
65
67
if ( child . props . name )
66
68
return React . cloneElement ( child , {
69
+ children,
67
70
onChange : this . onChange ,
68
71
onBlur : ( ) => this . onBlur ( child . props . name ) ,
69
72
error : errors [ child . props . name ] &&
@@ -78,10 +81,11 @@ export default class Form extends React.Component {
78
81
79
82
return React . createElement ( child . type , {
80
83
...otherProps ,
84
+ children,
81
85
onClick : ( ) => this . validate ( child . props . onClick ) ,
82
86
} ) ;
83
87
}
84
- return child ;
88
+ return React . cloneElement ( child , { children } ) ;
85
89
} ) ;
86
90
}
87
91
You can’t perform that action at this time.
0 commit comments