Nativebase: Unable to change Tabs backgraound color

Created on 17 May 2018  路  4Comments  路  Source: GeekyAnts/NativeBase

style={{backgroundColor:"red"}} doesn't work in tab unable to change background color
how to change tab background color ?

<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>

Most helpful comment

@StudioAleph use tabStyle and activeTabStyle of <Tab/>.

Usage

 <Tabs renderTabBar={() => <ScrollableTab />}>
          <Tab heading="Tab1" tabStyle={{ backgroundColor: "red" }} activeTabStyle={{ backgroundColor: "green" }}>
            <Text>Tab one</Text>
          </Tab>        
</Tabs>

All 4 comments

@StudioAleph use tabStyle and activeTabStyle of <Tab/>.

Usage

 <Tabs renderTabBar={() => <ScrollableTab />}>
          <Tab heading="Tab1" tabStyle={{ backgroundColor: "red" }} activeTabStyle={{ backgroundColor: "green" }}>
            <Text>Tab one</Text>
          </Tab>        
</Tabs>

This doesn't work if you are rendering an icon in the tab header:

 <Tabs>
          <Tab
            tabStyle={{ backgroundColor: "#5078F2" }}
            activeTabStyle={{ backgroundColor: "#5078F2" }}
            heading={
              <TabHeading>
                <Icon name="apps" />
              </TabHeading>
            }
          >
            <View>
              <Text>Hi there - Tab 1</Text>
            </View>
          </Tab>
          <Tab
            tabStyle={{ backgroundColor: "#5078F2" }}
            activeTabStyle={{ backgroundColor: "#5078F2" }}
            heading={
              <TabHeading>
                <Icon name="apps" />
              </TabHeading>
            }
          >
            <View>
              <Text>Hi there - Tab 2</Text>
            </View>
          </Tab>
        </Tabs>

@ghoshabhi #2349

@ghoshabhi you can solve with this if the color its same when active
<Tab heading={ <TabHeading style={{backgroundColor: '#ffffff'}}> <Icon name="apps" /> </TabHeading> } > <View> <Text>Hi there - Tab 1</Text> </View> </Tab>

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aloifolia picture aloifolia  路  3Comments

Landerson352 picture Landerson352  路  3Comments

muthuraman007 picture muthuraman007  路  3Comments

Cotel picture Cotel  路  3Comments

natashache picture natashache  路  3Comments