3

使用react-native-ui-kitten组件BottomNavigationBottomNavigationTab在我在 iPhone 上运行的应用程序(expo v2.21.2react-native v0.57.1​​ )中,当前选定的顶部有一条水平线,BottomNavigationTab其中包含标题和图标。

从我的应用程序:

测试 B选项卡被选中,并且在图标上方有不需要的水平线。

在此处输入图像描述

从文档:

BottomNavigation文档显示,当同时定义标题和图标时,所选选项卡上没有水平线。但这对我来说不是这样。

在此处输入图像描述

问题:如何去除水平线?

我的代码:

import { View } from 'react-native';
import { createBottomTabNavigator, createStackNavigator, createSwitchNavigator, createAppContainer } from 'react-navigation';
import { BottomNavigation, BottomNavigationTab, BottomNavigationProps, Avatar } from 'react-native-ui-kitten';

class BottomNavigationShowcase extends React.Component {

    ... 

    render () {
        return (
            <BottomNavigation
                selectedIndex={this.state.selectedIndex}
                onSelect={this.onTabSelect}
            >
                <BottomNavigationTab title='Test A' icon={this.renderIconA} />
                <BottomNavigationTab title='Test B' icon={this.renderIconB} />
                <BottomNavigationTab title='Test C' icon={this.renderIconC} />
                <BottomNavigationTab title='Test D' icon={this.renderIconD} />
            </BottomNavigation>
        );
    }

}

const TabNavigator = createBottomTabNavigator(
    {
        TestA: TestAScreen,
        TestB: TestBScreen,
        TestC: TestCScreen,
        TestD: TestDScreen
    }, {
        initialRouteName: 'TestA',
        tabBarComponent: BottomNavigationShowcase
    }
)

const RootNavigator = createSwitchNavigator({
    Main: TabNavigator,
}, {
    initialRoute: "Main"
})
4

1 回答 1

4

只需尝试将属性添加到BottomNavigation-component: appearance='noIndicator'。看起来我们忘记了在文档中显示此功能。希望这可以帮助。

于 2019-07-22T16:04:03.680 回答