反应导航BottomTabNavigator上的线性渐变

时间:2018-05-31 14:10:59

标签: react-native react-navigation linear-gradients

我正在尝试将线性渐变应用于react-navigation v2的BottomTabNavigator。我尝试使用createBottomTabNavigatorthis answer关注Expo LinearGradient,但我收到的错误如下所示:

Error

这是我的代码:

const GradientTab = props => {
    console.log(props);
    return (
        <View style={{ backgroundColor: 'transparent' }}>
            <LinearGradient
                colors={['white', 'rgba(214,234,241,0.77)']}
                style={{
                    position: 'absolute',
                    left: 0,
                    right: 0,
                    top: 0,
                    height: 72
                }}
            >
                <TabBarBottom {...props} />
            </LinearGradient>
        </View >
    )
};

export default AuthorizedNavigator = createBottomTabNavigator({
    routeConfigs, 
    {
        tabBarComponent: GradientTab,
        tabBarPosition: 'bottom',
        tabBarOptions: {
            style: {
                height: 72,
                backgroundColor: 'white'
            }
        },
        initialRouteName: 'Home'
    }
);

0 个答案:

没有答案