我正在使用react-native和react-navigation。抽屉物品图标非活动色调颜色似乎不像我预期的那样工作。如果我应用了一种色调,即使文本看起来没问题,图标颜色看起来也有点褪色,如果我让它透明(rgba(0,0,0,0)),它会变成白色。我尝试了几种方法,但我无法找到答案。如果有人帮助我,我真的很感激。
Index.ios.js
const CustomDrawerContentComponentDistributor = (props) => (
<ScrollView><DrawerItems {...props} /></ScrollView>
);
const Distributor = DrawerNavigator({
Dashboard: {screen: Dashboard },
Quality: {screen: Quality},
},
{
drawerPosition: 'left',
drawerWidth: Dimensions.get('window').width - (Platform.OS === 'android' ? 56 : 64),
contentOptions: {
activeTintColor: '#d03036',
activeBackgroundColor : 'rgba(0,0,0,0)',
inactiveBackgroundColor : 'rgba(0,0,0,0)',
inactiveTintColor: '#545f7a',
style: {
marginVertical: 0
},
labelStyle: {
fontWeight:'bold',
fontFamily:'Roboto',
backgroundColor: 'transparent'
}
},
contentComponent: CustomDrawerContentComponentDistributor
}
);
页
class Quality extends React.Component {
constructor(props){
super(props);
}
static navigationOptions = {
drawerLabel: 'QUALITY',
drawerIcon: ({ tintColor }) => (
<Image
source={require('../../img/ic-menu-quality3x.png')}
style={[styles.menuIcon, { tintColor: "#545f7a", resizeMode:'contain', backgroundColor:'transparent'}]} />
),
header : null
};