callstackincubator / rebolt-navigation

Fast and declarative router for Rebolt
https://rebolt-navigation.callstack.com/
MIT License
208 stars 11 forks source link

Navigation's headerTitle is fixed #122

Open aloifolia opened 6 years ago

aloifolia commented 6 years ago

When I use Rebolt's stack navigation with navigation bars, I can initialize the title of the navigation by setting the property headerTitle of a screen component. The title then remains fixed to this initial value. If I want to have it changed dynamically, whenever some state in my app changes, the only "option" (this is not really an option) is to leave the screen and reopen it.

Usually the default behaviour is fine. However, if you implement a language switch inside the app, you will see that every screen on the stack (at the moment when the language is switched) keeps its title as long as it is alive.

Ultimately I have to restart the app to see any changes in the navigation bar for the start screen of the app.

baransu commented 6 years ago

Right now StackNavigator assigns header props in Screen's didMount lifecycle and ignores further changes. There is possibility to use retainedProps and update header in didUpdate lifecycle. #124 should fix that.