Zol*_*adi 3 react-native react-navigation react-native-vector-icons
在我的React Native应用中,我想使用Vector Icons作为导航栏按钮。为此,我正在使用:https : //github.com/oblador/react-native-vector-icons 导航:https : //reactnavigation.org/
我也设法设置了图标,但是当我点击按钮时,背景变成黑色,我得到了不想要的效果。有没有办法在按下按钮时也能保持背景色透明?
这是我的代码:
static navigationOptions = ({ navigation }) => {
const { params } = navigation.state
return {
headerTitle: "Blog posts",
headerRight: (
<Icon.Button name="quote-right" backgroundColor="transparent" color="black" onPress={() => params.postComment()}>
<Text style={{fontSize: 15}}></Text>
</Icon.Button>
),
headerLeft: (
<Icon.Button name="navicon" backgroundColor="transparent" color="black" onPress={() => params.postComment()}>
<Text style={{fontSize: 15}}></Text>
</Icon.Button>
),
};
};
Run Code Online (Sandbox Code Playgroud)
这就是我得到的:
您要寻找的道具是underlayColor那应该设置的道具transparent。
<Icon.Button
name="quote-right"
backgroundColor="transparent"
underlayColor="transparent" // This one
color="black"
onPress={() => params.postComment()}
>
<Text style={{fontSize: 15}}></Text>
</Icon.Button>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1298 次 |
| 最近记录: |