@@ -22,7 +22,12 @@ class MainPage extends Component{
2222
2323 render ( ) {
2424 return (
25- < BottomTabBar navigator = { this . props . navigator } mainThemeColor = { this . props . mainThemeColor } />
25+ < BottomTabBar
26+ navigator = { this . props . navigator }
27+ mainThemeColor = { this . props . mainThemeColor }
28+ rowItemBackgroundColor = { this . props . rowItemBackgroundColor }
29+ tabIconColor = { this . props . tabIconColor }
30+ />
2631 ) ;
2732 }
2833}
@@ -36,14 +41,14 @@ class BottomTabBar extends Component{
3641 }
3742
3843 _renderItem ( Component , tab , tabName , normalIcon , selectedIcon ) {
39- const { navigator, mainThemeColor} = this . props ;
44+ const { navigator, mainThemeColor, tabIconColor } = this . props ;
4045 return (
4146 < TabNavigator . Item
4247 selected = { this . state . selectedTab === tab }
4348 title = { tabName }
44- selectedTitleStyle = { { color : mainThemeColor } }
49+ selectedTitleStyle = { { color : tabIconColor } }
4550 renderIcon = { ( ) => < Image style = { styles . tabBarItemIcon } source = { normalIcon } /> }
46- renderSelectedIcon = { ( ) => < Image style = { [ styles . tabBarItemIcon , { tintColor : mainThemeColor } ] } source = { selectedIcon } /> }
51+ renderSelectedIcon = { ( ) => < Image style = { [ styles . tabBarItemIcon , { tintColor : tabIconColor } ] } source = { selectedIcon } /> }
4752 onPress = { ( ) => this . setState ( { selectedTab : tab } ) } >
4853 { < Component navigator = { navigator } /> }
4954 </ TabNavigator . Item >
@@ -54,7 +59,7 @@ class BottomTabBar extends Component{
5459 return (
5560 < TabNavigator
5661 hidesTabTouch = { true }
57- tabBarStyle = { styles . tabBarStyle }
62+ tabBarStyle = { [ styles . tabBarStyle , { backgroundColor : this . props . rowItemBackgroundColor } ] }
5863 sceneStyle = { {
5964 paddingTop : theme . toolbar . paddingTop , //immersive experience
6065 paddingBottom : styles . tabBarStyle . height } } >
@@ -67,25 +72,25 @@ class BottomTabBar extends Component{
6772 }
6873
6974 componentWillMount ( ) {
70- const mainThemeColor = this . props . mainThemeColor ;
75+ const tabIconColor = this . props . tabIconColor ;
7176 if ( Platform . OS === 'ios' ) {
7277 Icon . getImageSource ( 'ios-home-outline' , 100 , theme . tabButton . normalColor ) . then ( ( source ) => this . setState ( { homeNormal : source } ) ) ;
73- Icon . getImageSource ( 'ios-home-outline' , 100 , mainThemeColor ) . then ( ( source ) => this . setState ( { homeSelected : source } ) ) ;
78+ Icon . getImageSource ( 'ios-home-outline' , 100 , tabIconColor ) . then ( ( source ) => this . setState ( { homeSelected : source } ) ) ;
7479 Icon . getImageSource ( 'ios-compass-outline' , 100 , theme . tabButton . normalColor ) . then ( ( source ) => this . setState ( { compassNormal : source } ) ) ;
75- Icon . getImageSource ( 'ios-compass-outline' , 100 , mainThemeColor ) . then ( ( source ) => this . setState ( { compassSelected : source } ) ) ;
80+ Icon . getImageSource ( 'ios-compass-outline' , 100 , tabIconColor ) . then ( ( source ) => this . setState ( { compassSelected : source } ) ) ;
7681 Icon . getImageSource ( 'ios-list-box-outline' , 100 , theme . tabButton . normalColor ) . then ( ( source ) => this . setState ( { moreNormal : source } ) ) ;
77- Icon . getImageSource ( 'ios-list-box-outline' , 100 , mainThemeColor ) . then ( ( source ) => this . setState ( { moreSelected : source } ) ) ;
82+ Icon . getImageSource ( 'ios-list-box-outline' , 100 , tabIconColor ) . then ( ( source ) => this . setState ( { moreSelected : source } ) ) ;
7883 Icon . getImageSource ( 'ios-cube-outline' , 100 , theme . tabButton . normalColor ) . then ( ( source ) => this . setState ( { collectionNormal : source } ) ) ;
79- Icon . getImageSource ( 'ios-cube-outline' , 100 , mainThemeColor ) . then ( ( source ) => this . setState ( { collectionSelected : source } ) ) ;
84+ Icon . getImageSource ( 'ios-cube-outline' , 100 , tabIconColor ) . then ( ( source ) => this . setState ( { collectionSelected : source } ) ) ;
8085 } else if ( Platform . OS === 'android' ) {
8186 Icon . getImageSource ( 'md-home' , 100 , theme . tabButton . normalColor ) . then ( ( source ) => this . setState ( { homeNormal : source } ) ) ;
82- Icon . getImageSource ( 'md-home' , 100 , mainThemeColor ) . then ( ( source ) => this . setState ( { homeSelected : source } ) ) ;
87+ Icon . getImageSource ( 'md-home' , 100 , tabIconColor ) . then ( ( source ) => this . setState ( { homeSelected : source } ) ) ;
8388 Icon . getImageSource ( 'md-compass' , 100 , theme . tabButton . normalColor ) . then ( ( source ) => this . setState ( { compassNormal : source } ) ) ;
84- Icon . getImageSource ( 'md-compass' , 100 , mainThemeColor ) . then ( ( source ) => this . setState ( { compassSelected : source } ) ) ;
89+ Icon . getImageSource ( 'md-compass' , 100 , tabIconColor ) . then ( ( source ) => this . setState ( { compassSelected : source } ) ) ;
8590 Icon . getImageSource ( 'md-list-box' , 100 , theme . tabButton . normalColor ) . then ( ( source ) => this . setState ( { moreNormal : source } ) ) ;
86- Icon . getImageSource ( 'md-list-box' , 100 , mainThemeColor ) . then ( ( source ) => this . setState ( { moreSelected : source } ) ) ;
91+ Icon . getImageSource ( 'md-list-box' , 100 , tabIconColor ) . then ( ( source ) => this . setState ( { moreSelected : source } ) ) ;
8792 Icon . getImageSource ( 'md-cube' , 100 , theme . tabButton . normalColor ) . then ( ( source ) => this . setState ( { collectionNormal : source } ) ) ;
88- Icon . getImageSource ( 'md-cube' , 100 , mainThemeColor ) . then ( ( source ) => this . setState ( { collectionSelected : source } ) ) ;
93+ Icon . getImageSource ( 'md-cube' , 100 , tabIconColor ) . then ( ( source ) => this . setState ( { collectionSelected : source } ) ) ;
8994 }
9095 }
9196
@@ -95,23 +100,24 @@ class BottomTabBar extends Component{
95100 }
96101}
97102
103+ const mapStateToProps = ( state ) => {
104+ return {
105+ mainThemeColor : state . settingState . colorScheme . mainThemeColor ,
106+ rowItemBackgroundColor : state . settingState . colorScheme . rowItemBackgroundColor ,
107+ tabIconColor : state . settingState . colorScheme . tabIconColor
108+ } ;
109+ } ;
110+
98111const styles = {
99112 tabBarItemIcon : {
100113 width : px2dp ( 20 ) ,
101114 height : px2dp ( 20 )
102115 } ,
103116 tabBarStyle : {
104117 height : px2dp ( 45 ) ,
105- backgroundColor : '#fff' ,
106118 alignItems : 'center' ,
107119 paddingTop : Platform . OS === 'android' ? px2dp ( 6 ) : px2dp ( 3 )
108120 }
109121}
110122
111- const mapStateToProps = ( state ) => {
112- return {
113- mainThemeColor : state . settingState . dayMode . mainThemeColor
114- } ;
115- } ;
116-
117123export default connect ( mapStateToProps ) ( MainPage ) ;
0 commit comments