react-navigation / react-navigation/react-navigation.github.io
Indicator not aligned with text in createMaterialTopTabNavigator
未关闭
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 324
- 派生
- 2k
- PR 合并指标
- 30 天内没有已合并 PR
描述
I am trying to implement the top tab with scrollable tabs which are dynamic in number.
Following is my code:
<View style={{flex: 1}}>
{categories.length > 0 && (
<Tab.Navigator
lazy
tabBarOptions={{
labelStyle: {
fontSize: 13,
fontFamily: gothamMedium,
textTransform: 'none',
alignSelf: 'center',
textAlign: 'center',
},
indicatorStyle: {
backgroundColor: colors.AQUAMARINE,
height: 4,
},
activeTintColor: colors.GREYISH_BROWN,
inactiveTintColor: colors.WARM_GREY,
scrollEnabled: true,
}}>
{categories.map(category => (
<Tab.Screen
options={{
title: category.title,
}}
name={category.title}
component={() => <TabList tabData={category} />}
/>
))}
</Tab.Navigator>
)} </View>
Which works fine for the first tab:

And here is how second tab looks like:
And it gets worse scrolled to 3rd and beyond
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先使用 issue 中所示的动态 categories 和 Tab.Navigator 配置,复现使用 createMaterialTopTabNavigator 时报告的 indicator 对齐问题。比较第一个、第二个以及后续可滚动 tab,并在 indicator 与每个 tab 的文本都能保持一致对齐时,认为 issue 已完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, react, react-native
- 领域
- mobile
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100