Skip to content

Mysterious fontSize issue with tabBarTextStyle  #40

@jasongaare

Description

@jasongaare

This took me forever to hunt down what was even causing my problem, and frankly I'm stumped as to the underlying issue and how to solve it.

Code

<ScrollableTabView
  renderTabBar={() => (
    <TabBar
      underlineColor="black"
      activeTabTextStyle={{ color: 'black' }}
      tabBarTextStyle={{
        color: 'rgba(0,0,0,0.5)',
        fontSize: 16,      // <--- spoiler alert: this is causing my issue
        fontWeight: 'bold',
      }}
      tabBarStyle={{
        borderBottomColor: colors.lightGray,
      }}
    />
  )}
>
  <FlatList
    tabLabel={{ label: 'users' }}
    data={userData}
    renderItem={this.renderUserItem}
    refreshControl={
      <RefreshControl
        refreshing={this.state.usersRefreshing}
        onRefresh={this.refreshUsers}
      />
    }
  />
  <FlatList
    tabLabel={{ label: 'groups' }}
    data={groupData}
    renderItem={this.renderGroupItem}
    refreshControl={
      <RefreshControl
        refreshing={this.state.usersRefreshing}
        onRefresh={this.refreshUsers}
      />
    }
  />
</ScrollableTabView>

everything works well, EXCEPT with the FlatList when the list is shorter than the height of my screen (i.e. only two or three elements) I cannot scroll the FlatList AND I cannot pullToRefresh

The Fix

After trying everything, I found that if I removed the fontSize: 16 from the tabBarTextStyle on the TabBar all my scrolling worked as expected on the FlatList. Not ideal, but something I can deal with for now.

Any idea why this might be or how I can apply a fontSize without it disabling my scrolling on these FlatLists?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions