react-native - 博览会常量在本机反应中不起作用
问题描述
对于状态栏而不是使用平台,我使用了 expo 常量,它工作正常突然我决定制作 expo 组件并对其进行样式设置,
export default function ExpoScreen({ Children }) {
return <SafeAreaView style={styles.screen}>{Children}</SafeAreaView>;
}
const styles = StyleSheet.create({
screen: {
paddingTop: Constants.statusBarHeight,
},
});
这是我的保存屏幕,我在其中导入 expoScreen 组件,但它没有给出任何结果,它给出了一个白屏,没有任何错误
export default function MessageScreen() {
return (
<ExpoScreen>
<FlatList
data={messages}
keyExtractor={(message) => message.id.toString()}
renderItem={({ item }) => (
<ListItem
title={item.title}
sutitle={item.description}
image={item.image}
/>
)}
/>
</ExpoScreen>
);
}
解决方案
您正在使用C孩子而不是孩子将其更改为
function ExpoScreen({ children }) {
return <SafeAreaView style={styles.screen}>{children}</SafeAreaView>;
}
推荐阅读
- javascript - 如何在提交反应之前检查多个文本框验证
- nuget - NuGet 版本范围 - 始终获取具有最高修订号的包
- mysql - 与另一个表连接时,即使第一个表为空(并且查询没有 IN),SQL 查询也会返回 null
- javascript - 如何使用 clip-path CSS 属性截取 HTML 节点的屏幕截图?(html2canvas 不适用于此)
- amazon-web-services - 如何让 AWS lambda 将字符串值传递给 s3 存储桶中的 index.html
- css - Angular NgStyle:列表图像样式
- linux-device-driver - 在 Android 上添加对 DSI 面板的支持的工作流程
- javascript - 循环遍历数据对象并将 Header 映射到 React 中的值
- rxjs - NestJS HttpService - 如何转换响应数据?
- javascript - 从文本构建和格式化日期