Skip to content

Commit

Permalink
use React.Children.count for counting children
Browse files Browse the repository at this point in the history
  • Loading branch information
vonovak authored May 27, 2020
1 parent fd97e95 commit a6b6140
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -1095,8 +1095,7 @@ function InternalTextInput(props: Props): React.Node {
const style = [props.style];
const autoCapitalize = props.autoCapitalize || 'sentences';
let children = props.children;
let childCount = 0;
React.Children.forEach(children, () => ++childCount);
const childCount = React.Children.count(children);
invariant(
!(props.value && childCount),
'Cannot specify both value and children.',
Expand Down

0 comments on commit a6b6140

Please sign in to comment.