react-native - 在 Appbar.content 上面有空白空间
问题描述
我正在使用以下代码创建带有react-native-paper
and的标头react-navigation
:
return (
<Appbar.Header theme={{ colors: { primary: "white" } }}>
{previous ? (
<Appbar.BackAction onPress={navigation.pop} color={theme.colors.primary} />
) : (
<TouchableOpacity onPress={()=>{navigation.openDrawer();}}>
<Avatar.Image
size={40}
source={{uri: "https://i.imgur.com/2tTU7q1.jpg"}}
/>
</TouchableOpacity>
)}
<Appbar.Content
title={
<Image source={require("../../assets/images/icon.png")}
style={{
width: 40,
height: 40,
}}
/>
}
titleStyle={{backgroundColor: "red",}}
style={{alignItems: "center"}}
/>
</Appbar.Header>
);
结果是我系统地得到了Image上方的一个空白空间(把背景放红,让它更明显):
该空间在 .jpg 中不存在,实际上与任何图片一起出现。@expo/vector-icons
如果我使用 MaterialCommunityIcons (from ) 而不是图像,则不会出现此空间。
知道是什么原因造成的以及如何删除它吗?
解决方案
推荐阅读
- java - Cucumber Java 如何更新 DataTable 中的元素
- mongodb - 使用测试容器和 docker 的集成测试问题“原因:java.lang.NullPointerException:未指定 containerId”
- excel - 在 Power Pivot DAX 中获取全年工作日
- javascript - 使用外部 json 数据在画布 js 中渲染图形
- ubuntu - 在 ubuntu 上构建 ffmpeg:构建 nasm 失败
- jenkins-pipeline - 神器配置
- c# - 获取与 LINQ to XML 中的模式匹配的属性值的 C# Lambda 方法语法
- vue.js - 使用 v-for 检索被点击元素的数据属性值
- javascript - Actions on Google - 未找到应用请求许可的意图
- python - 如何将列拆分为具有相同列名并在 Python 中具有相同值的两个?