galio icon indicating copy to clipboard operation
galio copied to clipboard

Navbar with Image

Open ehdwns980416 opened this issue 4 years ago • 1 comments

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
    }}
/>

ehdwns980416 avatar Aug 14 '20 04:08 ehdwns980416

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,
            }}
        />
    }
/>

NavBar - Documentation @ galio image

ehdwns980416 avatar Aug 14 '20 04:08 ehdwns980416