提示IllegalViewOperationException("Unexpected view type nested under a <Text> or <TextInput> node: " + child.getClass())的解决方案
问题原因
在React Native中,当出现IllegalViewOperationException("Unexpected view type nested under a 解决方案
在React Native中,出现IllegalViewOperationException("Unexpected view type nested under a
import React from 'react';
import { View, Text } from 'react-native';
const MyComponent = () => {
return (
Hello,
World!
);
};
export default MyComponent;
在这个示例中,具体例子
在React Native中,当出现IllegalViewOperationException("Unexpected view type nested under a
import React from 'react';
import { View, Text, TextInput, StyleSheet } from 'react-native';
const App = () => {
return (
Hello,
React Native !
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
text: {
fontSize: 20,
color: 'black',
},
boldText: {
fontWeight: 'bold',
},
input: {
borderWidth: 1,
borderColor: 'gray',
padding: 10,
marginTop: 20,
},
});
export default App;
在上面的例子中,