Skip to content

Commit e6bdaf7

Browse files
committed
Fix recursive render, closes #1
1 parent 35edc84 commit e6bdaf7

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

form.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ export default class Form extends React.Component {
99

1010
renderChildren(children) {
1111
return React.Children.map(children, (child, index) => {
12-
if (child.children) return this.renderChildren(children);
12+
if (child.children)
13+
return React.cloneElement(child, this.renderChildren(children));
1314
if (child.type.name !== 'TextInput') return child;
1415

1516
return React.cloneElement(child, {

package.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-autofocus",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"description": "Move to next input field on enter in a form",
55
"main": "index.js",
66
"scripts": {
@@ -10,11 +10,7 @@
1010
"type": "git",
1111
"url": "git+https://github.com/zackify/react-native-autofocus.git"
1212
},
13-
"keywords": [
14-
"react-native",
15-
"autofocus",
16-
"onenter"
17-
],
13+
"keywords": ["react-native", "autofocus", "onenter"],
1814
"author": "Zach Silveira",
1915
"license": "ISC",
2016
"bugs": {

0 commit comments

Comments
 (0)