Improve error message for text nodes in View

This commit is contained in:
Nicolas Gallagher
2017-09-21 14:04:41 -07:00
parent 450722153d
commit 3aa37450a0

View File

@@ -52,7 +52,10 @@ class View extends Component {
if (process.env.NODE_ENV !== 'production') {
React.Children.toArray(this.props.children).forEach(item => {
invariant(typeof item !== 'string', 'A text node cannot be a child of a <View>');
invariant(
typeof item !== 'string',
`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`
);
});
}