##tabs-def-headref
Tabs are a horizontal region of buttons or links that allow for a consistent navigation experience between screens. It can contain any combination of text and icons, and is a popular method for enabling mobile navigation.
Replacing Component: react-native-scrollable-tab-view <ScrollableTabView>
Syntax(simple)
import React, { Component } from 'react';
import { Container, Content, Tab, Tabs } from 'native-base';
import Tab1 from './tabOne';
import Tab2 from './tabTwo';
export default class TabsExample extends Component {
render() {
return (
<Container>
<Header hasTabs />
<Tabs>
<Tab heading="Tab1">
<Tab1 />
</Tab>
<Tab heading="Tab2">
<Tab2 />
</Tab>
<Tab heading="Tab3">
<Tab3 />
</Tab>
</Tabs>
</Container>
);
}
}Configuration
| Property | Default | Option | Description |
|---|---|---|---|
| locked | false | true false | Disable swipe |
| initialPage | - | integer | Set default active tab |
| tabBarPosition | top | top, bottom, overlayTop, overlayBottom | Set position of Tabs |
| renderTabBar | - | - | Accept 1 argument props and should return a component to use as the tab bar |
| onChangeTab | - | - | Function to call when tab changes |
| onScroll | - | - | Function to call when the pages are sliding, should accept 1 argument which is an Float number representing the page position in the slide frame |
| children | - | - | Each top-level child component should have a tabLabel prop that can be used by the tab bar component to render out the labels |
| tabBarUnderlineStyle | - | - | Style of the default tab bar's underline |
| tabBarBackgroundColor | white | - | Color of the default tab bar's background |
| tabBarActiveTextColor | navy | - | Color of the default tab bar's text when active |
| tabBarInactiveTextColor | black | - | Color of the default tab bar's text when not active. |
| scrollWithoutAnimation | false | true, false | On tab press change tab without animation. |
| prerenderingSiblingsNumber | 0 | - | pre-render nearby # sibling, Infinity === render all the siblings, default to 0 === render current page |
**Known Issues :** Custom tabHeading is not yet supported for
ScrollableTab heading only accepts a string. **Pro-Tip :** It is advisable to use hasTabs prop with Header while using Tabs.
##advanced-tabs-headref
Syntax(advanced)
import React, { Component } from 'react';
import { Container, Content, Tab, Tabs } from 'native-base';
import Tab1 from './tabOne';
import Tab2 from './tabTwo';
export default class TabsExample extends Component {
render() {
return (
<Container>
<Header hasTabs/>
<Tabs>
<Tab heading={ <TabHeading><Icon name="camera" /><Text>Camera</Text></TabHeading>}>
<Tab1 />
</Tab>
<Tab heading={ <TabHeading><Text>No Icon</Text></TabHeading>}>
<Tab2 />
</Tab>
<Tab heading={ <TabHeading><Icon name="apps" /></TabHeading>}>
<Tab3 />
</Tab>
</Tabs>
</Container>
);
}
}Syntax(scrollable)
import React, { Component } from 'react';
import { Container, Content, Tab, Tabs } from 'native-base';
import Tab1 from './tabOne';
import Tab2 from './tabTwo';
export default class TabsExample extends Component {
render() {
return (
<Container>
<Header hasTabs/>
<Tabs renderTabBar={()=> <ScrollableTab />}>
<Tab heading="Tab1">
<Tab1 />
</Tab>
<Tab heading="Tab2">
<Tab2 />
</Tab>
<Tab heading="Tab3">
<Tab3 />
</Tab>
<Tab heading="Tab4">
<Tab4 />
</Tab>
<Tab heading="Tab5">
<Tab5 />
</Tab>
</Tabs>
</Container>
);
}
}| Property | Default | Option | Description |
|---|---|---|---|
| heading | - | string, | Label String, or Component |
| tabStyle | - | style object | Style for tabbar |
| activeTabStyle | - | style object | Style for active tabbar |
| textStyle | - | style object | Style for text |
| activeTextStyle | - | style object | Style for active text |
Pro tip: It is advisable to use hasTabs prop with Header while using Tabs.



