File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -7,18 +7,18 @@ export default class Form extends React.Component {
7
7
this . inputs = [ ] ;
8
8
}
9
9
10
- renderChildren ( children ) {
10
+ renderChildren ( children , recursiveIndex = 0 ) {
11
11
return React . Children . map ( children , ( child , index ) => {
12
12
if ( child . props . children )
13
13
return React . cloneElement ( child , {
14
14
...child . props ,
15
- children : this . renderChildren ( child . props . children )
15
+ children : this . renderChildren ( child . props . children , index )
16
16
} ) ;
17
17
if ( child . type . name !== 'TextInput' ) return child ;
18
18
19
19
return React . cloneElement ( child , {
20
20
onEnter : ( ) =>
21
- this . inputs [ index + 1 ] ? this . inputs [ index + 1 ] . focus ( ) : null ,
21
+ this . inputs [ index + recursiveIndex + 1 ] ? this . inputs [ index + recursiveIndex + 1 ] . focus ( ) : null ,
22
22
inputRef : ref => ( this . inputs [ index ] = ref ) ,
23
23
} ) ;
24
24
} ) ;
You can’t perform that action at this time.
0 commit comments