From documentation: Highly Customizable Navigation Bar - Show/hide the navbar depending on Scene or even the state of a Scene (e.g. Edit/Save navbar for edit mode).
How can one show/hide the nav bar based on a state property? I could not find any example or explanation.
version -> "react-native-router-flux": "3.33.2",
Thanks in advance,
Pedro.
It's quite straight forward if you are using mobx/redux to manage your state, or if you have access to your state at the same level where you are defining your Scenes.
<Scene title="scene1" hideNavBar={() => this.state.hide} />
@i-am-kenny
The mentioned solution does not seem to work, is there any documentation on this?
@i-am-kenny @GuelorEmanuel that makes sense, but in that case we would have the "About Key xxx is already defined" being logged on each route change, right?
Because the Router would re-render on each state change.
I've just moved my scene definition for a const value, but I'm thinking that I might need to check state to decide some navbar UI stuff and I'm afraid I'll have again the log polluting the console... :/
Does anyone know how this works?
Is it possible to change the state of the navbar after it has been initialized?
I can set it to true and effectively it hides the NavBar, though i don't know if it can be done dynamically.
@and01 I'm using this method:
// show
Actions.refresh({ hideNavBar: false });
// hide
Actions.refresh({ hideNavBar: true });
I have it always hidden, why? because it's freaking ugly and i need customization in most of the pages, so each of my pages has it's own NavBar.
Most helpful comment
Does anyone know how this works?
Is it possible to change the state of the navbar after it has been initialized?