垂直居中显示标签栏图标-React Native

时间:2018-10-31 13:12:29

标签: react-native react-navigation react-native-ios react-native-navigation

创建自定义导航标签栏并将图标垂直居中时遇到问题。看起来像按照下面的屏幕截图那样被推高了一点:

enter image description here

这是标签导航的样式:

tabBarOptions: {
    activeTintColor: '#e91e63',
    labelStyle: {
        fontSize: 12,
    },
    style: {
        position: 'absolute',
        backgroundColor: 'white',
        width: DEVICE_WIDTH * 0.94,
        borderBottomLeftRadius: 33,
        borderBottomRightRadius: 33,
        borderTopLeftRadius: 10,
        borderTopRightRadius: 10,
        bottom: 12,
        marginLeft: '2.8%',
        shadowColor: '#000000',
        shadowOffset: {
          width: 0,
          height: 0.3
        },
        shadowRadius: 5,
        shadowOpacity: 0.1
    }

非常感谢!

1 个答案:

答案 0 :(得分:0)

可以通过为图标指定样式来解决此问题:

<Icon
    name="user"
    color={tintColor}
    size={28}
    style={{ textAlignVertical: 'center' }}
/>