Tell us which versions you are using:
The navbar refreshes with the new right button component
No effect
For non-obvious bugs, please fork this component, modify Example project to reproduce your issue and include link here.
````
static onEnter = () => {
const { wrappedInstance } = Actions.refs.profile
// this works
Actions.refresh({
rightTitle: "Logout",
onRight: wrappedInstance.onLogout
})
// this has no effect
Actions.refresh({
renderRightButton: () =>
})
}
````
Here is how I worked around it
<Scene
back
key={routes.PROFILE}
component={ProfileScene}
renderRightButton={
<MoreButton
onPress={() => Actions.refs.profile.wrappedInstance.onMorePress()}
/>
}
title="Profile"
/>
Thank you for the update about the workaround. This seems to be sort of a duplicate of #3188. I'll keep it marked as bug and work on both in the same PR.
@jamesholcomb It looks like a hack and probably just not supported by React Navigation 2.x (its SET_PARAMS action). Instead you should define one renderRightButton that changes its content depending from navigation state. Actions.refresh should be used just to update navigational state (i.e. pass values not functions)
Actions.refresh should be used just to update navigational state (i.e. pass values not functions)
I am attempting to upgrade a 3.X project to 4.0. Actions.refresh is used throughout the app to wire up navbar buttons to their scene handlers based on data/conditions that are determined within the scene.
The example does not seem to demonstrate how to go about this and the migration guide does not mention it.
Can you elaborate or point to an example?
Actions.refresh is used throughout the app to wire up navbar buttons to their scene handlers based on data/conditions that are determined within the scene.
I would also be interested in seeing an example of how to accomplish this with 4.0.
For react-navigation version 3.X use following example May be it also works with 4.x
class Companies extends Component {
componentDidMount(){
Actions.refresh({
right: () => (
<MaterialIcons
name={'mail'}
size={48}
color={'black'} />
)
})
}
render(){
...
}
}
Most helpful comment
For
react-navigationversion3.Xuse following example May be it also works with4.x