ex-navigation icon indicating copy to clipboard operation
ex-navigation copied to clipboard

hack to hide navbar

Open philipheinser opened this issue 7 years ago • 9 comments

philipheinser avatar Dec 01 '16 01:12 philipheinser

can't u do something like this:

static route = {
    navigationBar: {
      visible: false,
    },
}

sibelius avatar Dec 01 '16 14:12 sibelius

@sibelius I need to show and hide the navigator in the same scene. The method you mentioned is dynamic isn't it?

philipheinser avatar Dec 02 '16 15:12 philipheinser

it is not dynamic, I think it makes sense to have a hideNavigationBar method on this.props.navigator instead of this

sibelius avatar Dec 02 '16 15:12 sibelius

@sibelius Agree. This was just a quick hack that we used to solve this #283

philipheinser avatar Dec 02 '16 15:12 philipheinser

https://github.com/exponentjs/ex-navigation/issues/89#issuecomment-254920193

I think the best solution for your use case right now, is to have navigationBar: { visible: false } and render a navigationBar inside the render of your own component

so u can have more control of when to render it or not

like this:

render() {
   const navBar = this.state.navBarVisible ? this._renderNavBar() : null;

   return (
      <View>
           {navBar}
           {this._renderContent()}
     </View>
    )
}

sibelius avatar Dec 02 '16 15:12 sibelius

interesting! i'd be open to making the visible property either be a bool or a fn that accepts route obj similar to title and renderRight/renderLeft, that should solve the problem

brentvatne avatar Dec 23 '16 19:12 brentvatne

@sibelius regarding your workaround (this._renderNavBar()), is the best way to create something that looks like a navbar, or to import it? I'm having a tough time setting the correct props for <NavigationBar /> imported from ex-navigation (specifically, it asks me for scenes, getBarStyle and navigation state, the later of which I figured out, there are probably more).

JulianKingman avatar Jan 08 '17 23:01 JulianKingman

I made another NavigationBar based on ex-navigation NavigationBar that only require Title, left and right button

sibelius avatar Jan 08 '17 23:01 sibelius

I don't suppose you have that around somewhere that I could look at? I'm ending up stripping pretty much everything and recreating it completely.

JulianKingman avatar Jan 09 '17 00:01 JulianKingman