我是 ReactNative 开发的新手,即使没有 SafeAreaView 组件,我也无法弄清楚屏幕顶部和底部出现的空白。我正在我的手机上的 ExpoGo 应用程序上对此进行测试。
import React from "react";
import { Text, View, StyleSheet } from "react-native";
import Footer from "../components/Footer";
import LittleLemonHeader from "../components/LittleLemon";
import WelcomeScreen from "../components/WelcomeScreen";
import MenuItems from "../components/MenuItems";
export default function Index() {
return (
//<View style={{ flex: 1, backgroundColor: "#495E57" }}>
<View style={styles.container}>
<LittleLemonHeader />
<MenuItems />
<Footer />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#495E57",
padding: 0, // Ensure no padding in the container
margin: 0,
},
});
如果无法正常工作,您应该手动设置填充。