mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-01 01:59:10 +00: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') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
React.Children.toArray(this.props.children).forEach(item => {
|
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