我正在使用React Native,我是大一新生,这里有什么问题:错误在那里我正在使用React Native,我是大一新生,这里有什么问题:错误在这里我正在使用React Native,我是大一新生,这里有什么问题:错误在那里我正在使用React Native,我是大一新生,这里有什么问题:有错误吗我正在使用React Native,我是大一新生,这里有什么问题:有错误吗
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
export default function App() {
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<StatusBar style="auto" />
</View>
<View >
<Text>ffff</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'red',
},
});发布于 2020-10-22 14:15:35
您必须将内容包装在父节或视图中,如下所示:
import React from 'react';
import { StyleSheet, Text, View, StatusBar } from 'react-native';
export default function App() {
return (
<>
<StatusBar barStyle="dark-content"/>
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
</View>
<View >
<Text>ffff</Text>
</View>
</>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'red',
},
});https://stackoverflow.com/questions/64476268
复制相似问题