React-native-router-flux: How to hide nav bar based on state?

Created on 11 Oct 2016  路  7Comments  路  Source: aksonov/react-native-router-flux

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.

Most helpful comment

Does anyone know how this works?

Is it possible to change the state of the navbar after it has been initialized?

All 7 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

willmcclellan picture willmcclellan  路  3Comments

maphongba008 picture maphongba008  路  3Comments

wootwoot1234 picture wootwoot1234  路  3Comments

sreejithr picture sreejithr  路  3Comments

kirankalyan5 picture kirankalyan5  路  3Comments