React-native-navigation: How to change navigatorStyle dynamically?

Created on 5 Apr 2017  ·  3Comments  ·  Source: wix/react-native-navigation

How can I change navigatorStyle property for example navBarBackgroundColor dynamically at run time? For example in my app I want to change navigator background when user goes online :)

Only solution I have figured so far to hack this is to use resetTo without animation. This is otherwise good but it rerenders the view :S

Most helpful comment

You can use setStyle, available in 1.1.42

this.props.navigator.setStyle({
  screenBackgroundColor: 'red',
  navBarButtonColor: 'blue'
});

All 3 comments

Not sure how to change it dynamically, but you could set it to transparent and have a View hooked up behind it which changes color?

I find write this in the render function

this.props.navigator.setStyle({})

can change the navigatorStyle dynamically on iOS , any way to do the same on Android ?

You can use setStyle, available in 1.1.42

this.props.navigator.setStyle({
  screenBackgroundColor: 'red',
  navBarButtonColor: 'blue'
});
Was this page helpful?
0 / 5 - 0 ratings

Related issues

yayanartha picture yayanartha  ·  3Comments

switchtrue picture switchtrue  ·  3Comments

kiroukou picture kiroukou  ·  3Comments

ghost picture ghost  ·  3Comments

charlesluo2014 picture charlesluo2014  ·  3Comments