Skip to content
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 change navigationBarStyle based on routing parameters? #1294

Closed
cmrichards opened this issue Oct 17, 2016 · 1 comment
Closed

How to change navigationBarStyle based on routing parameters? #1294

cmrichards opened this issue Oct 17, 2016 · 1 comment
Labels

Comments

@cmrichards
Copy link

Version

Tell us which versions you are using:

  • react-native-router-flux v3.36.0
  • react-native v0.34.1

I'd like to change the colour of the navigation bar based on values of the parameters passed in. For example, in my app I have the concept of a job which can be 'complete' and 'in-progress'. When the job is 'complete' I'd like the navigation bar to show as green. Is this easily possible with rnrf?

If navigationBarStyle accepted a function then this could be made to work.

Thanks!

@dragfire
Copy link
Contributor

Yes indeed.

// props: {status: 'complete'}

componentWillMount() {
      if(this.props.status === 'complete') {
            Actions.refresh({ navigationBarStyle: {backgroundColor: 'green' }})         
      }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants