galio
galio copied to clipboard
Navbar with Image
I want to put my app logo in the <Navbar/>
without the title.
I tried to put in left
prop, but it's not work. How can I put image in the <Navbar/>
?
This is the code I tried.
import { Image } from 'react-native';
import { NavBar } from 'galio-framework';
...
const leftComponent = () => {
return (
<Image
resizeMode="contain"
source={require("../../images/logo-navbar.png")}
/>
);
}
...
<NavBar
title=""
style={styles.navbar}
left={leftComponent}
leftStyle={{
width: 270,
height: 80
}}
/>
I find the solution, and I want you to add function
type on the left
prop and right
one.
Those are just node
type, so I couldn't put function in them.
I can put <Image/>
with below code, but I need function type to look my code better.
<NavBar
flex
title=""
style={styles.navbar}
left={
<Image
resizeMode="contain"
source={require("../../images/logo-navbar.png")}
style={{
width: 270,
height: 80,
}}
/>
}
/>