我在“路由器”选项卡中定义了我的场景,如下所示:
<Scene
key="latest"
title="LATEST"
titleStyle={{flex:0}}
component={Latest}
onRight={()=>{}}
rightButtonImage={NOTIFICATION_ICON}
onLeft={()=>{}}
leftButtonImage={NAV_SEARCH_ICON}
/>
使用上面的代码,我可以使用以下代码在“最新”屏幕上进行导航操作:
componentDidMount() {
this.props.navigation.setParams({
'onRight': this.showNotifications,
'onLeft': this.showSearch,
})
}
因此,要从“最新”屏幕更新rightButtonImage,我尝试在setParams()方法内添加rightButtonImage:
this.props.navigation.setParams({
'onRight': this.showNotifications,
'onLeft': this.showSearch,
'rightButtonImage': {NOTIFICATION_ICON_ON}
})
因此,基本上,我想在新通知到达时更改通知响铃图标。但是,通过在setParams()中添加'rightButtonImage'无效。
有人可以帮忙吗?
尝试起诉 Actions.refresh
componentDidMount() {
Actions.refresh({
rightButtonImage : NOTIFICATION_ICON_ON // this should be an Image
});
}
或者您可以renderRightButton
在Actions.refresh
componentDidMount() {
Actions.refresh({
renderRightButton : XXXX // this should be an React.Component
});
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句