- 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
Contents:
- Header with only title
- Header with Title and Subtitle
- Header with Icon Buttons
- Header with Text Buttons
- Header with Icon Button and Text Button
- Header with Icon and Text Button
- Header with Multiple Icon Button
- Header Span
- Header No Shadow
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
| 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, default | Set iOS barStyle |
| androidStatusBarColor | - | - | Set background color for status bar in android |
| noShadow | - | boolean | Removes elevation from android |
| searchBar | - | boolean | Add searchbar to header or not |
| rounded | - | boolean | Make header searchbar rounded |
| hasSubtitle | - | boolean | Add subtitle to header |
| hasSegment | - | boolean | Add segments to header |
| hasTabs | - | boolean | Add tabs to header |
| span | - | boolean | Doubles the header size |

