diff --git a/docs/API_CONFIGURATION.md b/docs/API_CONFIGURATION.md index 9e079b116..916d9a2c1 100644 --- a/docs/API_CONFIGURATION.md +++ b/docs/API_CONFIGURATION.md @@ -92,6 +92,7 @@ Actions.ROUTE_NAME({type: ActionConst.RESET}); |-----------|--------|---------|--------------------------------------------| | tabs| `bool` | false | Defines 'TabBar' scene container, so child scenes will be displayed as 'tabs'. If no `component` is defined, built-in `TabBar` is used as renderer. All child scenes are wrapped into own navbar. | tabBarStyle | [`View style`](https://facebook.github.io/react-native/docs/view.html#style) | | optional style override for the Tabs component | +| tabBarBackgroundImage | [`Image source`](https://facebook.github.io/react-native/docs/image.html#source) | | optional background image for the Tabs component | | tabBarIconContainerStyle | [`View style`](https://facebook.github.io/react-native/docs/view.html#style) | | optional style override for the View that contains each tab icon | | hideTabBar | `bool` | false | hides tab bar for this scene and any following scenes until explicitly reversed (if built-in TabBar component is used as parent renderer)| | pressOpacity | `number` | 0.2 | the opacity when clicking on the tab | diff --git a/src/TabBar.js b/src/TabBar.js index d8c1d76a6..5fe10f51f 100644 --- a/src/TabBar.js +++ b/src/TabBar.js @@ -1,5 +1,8 @@ import React, { Component, PropTypes } from 'react'; -import { View } from 'react-native'; +import { + Image, + View, +} from 'react-native'; import Tabs from 'react-native-tabs'; import DefaultRenderer from './DefaultRenderer'; import Actions from './Actions'; @@ -51,6 +54,21 @@ class TabBar extends Component { ? true : deepestExplicitValueForKey(state, 'hideTabBar'); + const contents = ( + + {state.children.filter(el => el.icon || this.props.tabIcon).map(el => { + const Icon = el.icon || this.props.tabIcon; + return ; + })} + + ); return ( {!hideTabBar && state.children.filter(el => el.icon).length > 0 && - - {state.children.filter(el => el.icon || this.props.tabIcon).map(el => { - const Icon = el.icon || this.props.tabIcon; - return ; - })} - + (state.tabBarBackgroundImage ? ( + + {contents} + + ) : contents) } );