I am using the following code to create a header with 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>
);
The result is that I systematically get an empty space above the Image (put the background red to make it more obvious):
The space doesn't exist in the .jpg and actually appears with any picture. This space doesn't appear if I use a MaterialCommunityIcons (from @expo/vector-icons
) instead of the image.
Any idea what causes this and how to remove it?