- NativeBase component that renders as Header (navbar) for your screen.
- There can be a single Header component into your Container.
- To have Header for your screen, include
Headercomponent withinContainer. - Header takes input as:
Left,BodyandRight. - The components those are defined within
Headerwill be rendered in the same order that you define them. - Header provides you with stylesheet.
- User can add custom styles while defining
Headerwithin their app. - Replacing Component: React Native View
Syntax
import React, { Component } from 'react';
import { Container, Header, Left, Body, Right, Button, Icon, Title } from 'native-base';
export default class HeaderExample extends Component {
render() {
return (
<Container>
<Header>
<Left>
<Button transparent>
<Icon name='arrow-back' />
</Button>
</Left>
<Body>
<Title>Header</Title>
</Body>
<Right>
<Button transparent>
<Icon name='menu' />
</Button>
</Right>
</Header>
</Container>
);
}
}Configuration
<tr>
<td>noShadow</td>
<td> - </td>
<td> boolean </td>
<td>Removes elevation from android</td>
</tr>
<tr>
<td>searchBar</td>
<td> - </td>
<td> boolean </td>
<td>Add searchBar to header or not</td>
</tr>
<tr>
<td>rounded</td>
<td> - </td>
<td> boolean </td>
<td>Make Header searchBar Rounded</td>
</tr>
<tr>
<td>hasSubtitle</td>
<td> - </td>
<td> boolean </td>
<td>Add subtitle to the Header Component</td>
</tr>
<tr>
<td>hasSegment</td>
<td> - </td>
<td> boolean </td>
<td>Add Segments to Header Component</td>
</tr>
<tr>
<td>hasTabs</td>
<td> - </td>
<td> boolean </td>
<td>Add Tabs to Header Component</td>
</tr>
</tbody>
</table><br />
import React, { Component } from 'react';
import { Container, Header, Left, Body, Right, Title } from 'native-base';
export default class HeaderTitleExample extends Component {
render() {
return (
<Container>
<Header>
<Left/>
<Body>
<Title>Header</Title>
</Body>
<Right />
</Header>
</Container>
);
}
}import React, { Component } from 'react';
import { Container, Header, Left, Body, Right, Button, Icon, Title, Text } from 'native-base';
export default class HeaderIconTextExample extends Component {
render() {
return (
<Container>
<Header>
<Left>
<Button transparent>
<Icon name='arrow-back' />
</Button>
</Left>
<Body>
<Title>Header</Title>
</Body>
<Right>
<Button transparent>
<Text>Cancel</Text>
</Button>
</Right>
</Header>
</Container>
);
}
}import React, { Component } from 'react';
import { Container, Header, Left, Body, Right, Button, Icon, Title, Subtitle } from 'native-base';
export default class HeaderTitleSubtitleExample extends Component {
render() {
return (
<Container>
<Header>
<Left>
<Button transparent>
<Icon name='arrow-back' />
</Button>
</Left>
<Body>
<Title>Title</Title>
<Subtitle>Subtitle</Subtitle>
</Body>
<Right />
</Header>
</Container>
);
}
}| Property | Default | Option | Description |
|---|---|---|---|
| Left | - | - | Components render to the left in Header |
| Body | - | - | Components render at the center of Header |
| Right | - | - | Components render to the right in Header |
| iosBarStyle | - | 'light-content', 'dark-content' or 'default' | Set iOS barStyle |
| androidStatusBarColor | - | - | Set background color for status bar in android |
| backgroundColor | - | string | Set background color |



