Nativebase: How to make a background image header

Created on 23 Jul 2017  路  3Comments  路  Source: GeekyAnts/NativeBase

Hi,
I try this code to define image as background header but i don"t get correct result :
<Image source={require('./images/bg-header.png')} > <Header> <Left> <Button transparent> <Icon name='arrow-back' /> </Button> </Left> <Body> <Title >Header</Title> </Body> <Right> <Button transparent> <Icon name='menu' /> </Button> </Right> </Header> </Image>
How can i fix it please

Most helpful comment

@Geeksihem Try this

<Image  source={require('./images/bg-header.png')}  style={{ height: (Platform.OS === ios) ? 64: 56, width: null }}>
  <Header  style={{ backgroundColor: "transparent" }}>
    ......
  </Header>
</Image>

All 3 comments

@Geeksihem Try this

<Image  source={require('./images/bg-header.png')}  style={{ height: (Platform.OS === ios) ? 64: 56, width: null }}>
  <Header  style={{ backgroundColor: "transparent" }}>
    ......
  </Header>
</Image>

@shivrajkumar
This code doesn't work.

<Image  source={require('./images/bg-header.png')}  style={{ height: (Platform.OS === ios) ? 64: 56, width: null }}>
  <Header  style={{ backgroundColor: "transparent" }}>
    ...
  </Header>
</Image>

I'm using ImageBackground and works properly:

<ImageBackground source={require("../../assets/head-bg.png")} style={{width: "100%", height: 90}}> 
 <Header style={{
    backgroundColor: 'transparent', 
    elevation: 0,             // Remove shadow on Android
    shadowOpacity: 0         // Remove shadow on iOS
   }}>
    ...
  </Header>
</Image>

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

christianversloot picture christianversloot  路  3Comments

Cotel picture Cotel  路  3Comments

bsiddiqui picture bsiddiqui  路  3Comments

nschurmann picture nschurmann  路  3Comments

georgemickael-b picture georgemickael-b  路  3Comments