我正在尝试将线性渐变应用于react-navigation
v2的BottomTabNavigator。我尝试使用createBottomTabNavigator
和this answer关注Expo LinearGradient,但我收到的错误如下所示:
这是我的代码:
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'
}
);