mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-03-27 01:34:17 +08:00
Improve error message for text nodes in View
This commit is contained in:
@@ -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>.`
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user