![](/img/trans.png)
[英]JSX expressions must have one parent element.ts(2657) react native
[英]JSX expressions must have one parent element.ts(2657)
我正在使用 React Native,我是那里的新生,這里有什么問題:錯誤是我在使用 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',
},
});
您必須將您的內容包含在父部分中或像這樣查看:
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',
},
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.