NativeBase icon indicating copy to clipboard operation
NativeBase copied to clipboard

tab’s fontSize not working

Open oferRounds opened this issue 7 years ago • 11 comments

Using the latest NativeBase version (2.11), trying to change my tabs font, but it does not change:

<SafeAreaView style = {{ flex: 1, backgroundColor: 'transparent' }}>
        <Container style = {{ backgroundColor: 'transparent' }}>
          <Tabs
            style = {{ backgroundColor: 'transparent' }}
            tabBarUnderlineStyle = {{ backgroundColor: BOB_RED, height: 3 }}
            renderTabBar = {() =>
              <ScrollableTab
                backgroundColor = 'transparent'
                style = {{ backgroundColor: 'transparent' }}
              />
            }
          >
            <Tab
              textStyle = { styles.tabTextStyle as TextStyle }
              activeTextStyle = { styles.activeTabTextStyle as TextStyle  }
              tabStyle = { styles.tabStyle as ViewStyle }
              activeTabStyle = { styles.activeTabStyle as ViewStyle } heading = { currentSheetTabTitle}>
              <SingleTimesheetScreen
                sheetId = { Consts.THIS_MONTH_SHEET_ID }
                navigator = { this.props.navigator }
              />
            </Tab>
            <Tab
              textStyle = { styles.tabTextStyle as TextStyle }
              activeTextStyle = { styles.activeTabTextStyle as TextStyle }
              tabStyle = { styles.tabStyle as ViewStyle }
              activeTabStyle = { styles.activeTabStyle as ViewStyle } heading = { strings.previousSheetsTabTitle }>
              <TimesheetsListScreen
                navigator = { this.props.navigator }
              />
            </Tab>
          </Tabs>
        </Container>
      </SafeAreaView>
const styles = StyleSheet.create({
  tabTextStyle: {
    fontFamily: GOTHAM_BOOK, fontSize: 12, color: BOB_DARK_TEXT
  },
  activeTabTextStyle: {
    fontFamily: GOTHAM_MEDIUM, fontSize: 12, color: BOB_DARK_TEXT
  },
  tabStyle: {
    backgroundColor: 'transparent', top: 3
  },
  activeTabStyle: {
    backgroundColor: 'transparent'
  }
})

oferRounds avatar Feb 19 '19 10:02 oferRounds

Works fine tabs

SupriyaKalghatgi avatar Feb 21 '19 09:02 SupriyaKalghatgi

ok, it was because of the renderTabBar implementation, with the ScrollableTab. Do I need it for the ability to scroll-swipe between the tabs?

oferRounds avatar Feb 21 '19 13:02 oferRounds

Did you find a solution @oferRounds? I have the same problem with you. -_-

phanbien9x avatar Mar 13 '19 10:03 phanbien9x

I removed the renderTabBar override...

oferRounds avatar Mar 13 '19 11:03 oferRounds

No. Cause I need the scrollable tab. What I'm gonna do?

phanbien9x avatar Mar 14 '19 01:03 phanbien9x

@SupriyaKalghatgi

oferRounds avatar Mar 14 '19 07:03 oferRounds

I m facing the same issue, in my scenario i want to use renderTabBar , How can i change my font size??

BharathBunty avatar Apr 02 '19 04:04 BharathBunty

@BharathBunty @phanbien9x This is the only workaround that I've found to use ScrollableTab with fontSize change. You lose the activeTabStyle and activeTextStyle though. (someone may have an additional workaround for this loss)

<Tabs
    renderTabBar = {() =>
        <ScrollableTab />
    }>
    <Tab
        heading={ 
	    <TabHeading style={styles.tabStyle as ViewStyle}>
	        <Text style={styles.tabTextStyle as TextStyle}>
		    { currentSheetTabTitle}
	        </Text>
            </TabHeading>
	}>
            <SingleTimesheetScreen  />
        </Tab>
</Tabs>

lantractech avatar Apr 05 '19 04:04 lantractech

Facing same issue on native-base v2.12.1 @lantractech workaround works, thank you!

alexey-chernikov avatar Apr 08 '19 08:04 alexey-chernikov

@lantractech is working. But it is not working well for activeTextstyle.

smarttvdev avatar Nov 27 '19 10:11 smarttvdev

import {StyleProvider,Tabs,Tab} from 'native-base'; <StyleProvider style={{variables:{tabFontSize:12}}}> <Tabs></Tabs> </StyleProvider>

panyu1573 avatar Oct 11 '20 06:10 panyu1573