如何使createMaterialTopTabNavigator tabBar backgroundcolor变为线性渐变

时间:2019-08-06 07:12:52

标签: react-native react-native-android

我想使用backgroundcolor作为线性渐变,但是当我使用react-native-linear-gradient时,它什么也不显示为白色背景

我想将标签栏的蓝色更改为线性渐变颜色。

赞:

return {tr, setCustomRange: setTr};

enter image description here

1 个答案:

答案 0 :(得分:0)

您可以尝试tabBarComponent

示例

import React, {Fragment} from 'react';
import { createMaterialTopTabNavigator, MaterialTopTabBar } from "react-navigation"
...
tabBarComponent: props => return (
        <Fragment>
            <LinearGradient colors={['#ef7f1a','#fbb040']} start={{ x: 0, y: 0 }}
           end={{ x: 1, y: 1 }}/>
            <MaterialTopTabBar/>
        </Fragment>

    )