New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set header title with value from redux state #313
Comments
AFAIK you can't hook directly to a redux store but you could do something like this:
This assumes total charge gets set in redux after you initial mount of the component. If it starts off populated you would do the setParams in the will mount or constructor as well since |
@rmevans9 is right, that is one way to do it, the other way is to have a pre-connected title component:
|
@rmevans9 thanks, my problem was solved |
@rmevans9 Your solution worked for me too, cheers! |
I did the same however I ran into two issues: |
Check to make sure only when the nextProp is changing
|
Thank you that makes sense. Cheers |
The |
its really simple you can make stateless component and connect it with redux like this :
and then use it in static options :
|
Please see this answer for an easier way to do this: https://stackoverflow.com/a/51883306/6942666 |
When i try to use a connected component in navigationOptions.header, i get: TypeError: Object is not a function (near '...renderHeader...') . How can i add a connect() component to navigationOptions.header? |
Hi, i connected react-navigation to redux and when I try to add values from redux as part of the header title, I get an error. What is the correct code to accomplish this?
my code:
the error:
The text was updated successfully, but these errors were encountered: