我使用react-native-router-flux
进行了相当充实的项目,并尝试通过props
传递对象。通常情况下,我可以致电Actions.someKey({ someProp: object })
进行导航,但我尝试使用rightButtonImage
进行导航,但无法访问该组件props
例如:
Router.js
<Router>
<Scene1
rightButtonImage={someImage}
onRight={() => Actions.sceneTwo()}
/>
<Scene2 key="sceneTwo" />
</Router>
当我移动到Scene2时,我想传递一个Scene1&#39组件有权访问的对象。
答案 0 :(得分:1)
它对您有所帮助: 在每个组件中,即在componentDidMount中,您可以执行以下操作:
Actions.refresh({
rightTitle: "Next",
rightButtonTextStyle: {color: 'red'},
onRight: this.goSomewhere,
rightButtonImage: someImage
})