首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使指示器覆盖在选项卡上而不是相反

如何使指示器覆盖在选项卡上而不是相反
EN

Stack Overflow用户
提问于 2020-09-28 05:12:42
回答 1查看 14关注 0票数 0

了解reactnative并知道如何使用reactnative导航的人。

我正在创建一个开源应用程序,并在其上使用MaterialTopTabNavigator。当我设置选项卡和指示器的样式(使用indicatorStyle和tabStyle)时,选项卡会覆盖指示器,使其不可见。有人知道怎么修吗?我想让指示器覆盖在选项卡上,而不是相反

GitHub存储库:https://www.github.com/arthrc/packly src/route.js第30~49行

代码语言:javascript
复制
export default function Routes() {
    return (
        <Tab.Navigator 
        initialRouteName='Home'
        tabBarOptions={{
            activeTintColor: '#fff',
            inactiveTintColor: '#f7f7f7',
            tabStyle: { backgroundColor: '#a500ff'},
            indicatorStyle: {
                height: 6,
                bottom: -3,
                backgroundColor: '#D70CE8',
                width:100,
            },
            labelStyle: {
                fontFamily: 'Inter_600SemiBold',
                fontSize: 16
            }
        }}
        >
EN

回答 1

Stack Overflow用户

发布于 2020-09-28 06:04:07

我刚刚把tabStyle改成了style,它工作得很好

最终代码:

代码语言:javascript
复制
export default function Routes() {
    return (
        <Tab.Navigator 
        initialRouteName='Home'
        tabBarOptions={{
            activeTintColor: '#fff',
            inactiveTintColor: '#f7f7f7',
            tabStyle: { backgroundColor: '#a500ff'},
            indicatorStyle: {
                height: 6,
                bottom: -3,
                backgroundColor: '#D70CE8',
                width:100,
            },
            labelStyle: {
                fontFamily: 'Inter_600SemiBold',
                fontSize: 16
            }
        }}
        >
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64093380

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档