Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hiding and showing the navigation bar declaratively #16

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion ExNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ import ExSceneConfigs from './ExSceneConfigs';

import type * as ExRoute from './ExRoute';

class NavigationBar extends React.Component {
render () {
let routeOptions = this.props.navState.routeStack.slice(-1)[0].showNavigationBar
let showNavigationBar = this.props.navigator.props.showNavigationBar

if (routeOptions !== undefined) {
showNavigationBar = routeOptions
}
if (showNavigationBar) {
return (
<Navigator.NavigationBar {...this.props} />
)
} else {
return null
}
}
}

export default class ExNavigator extends React.Component {
static Styles = ExNavigatorStyles
static SceneConfigs = ExSceneConfigs;
Expand All @@ -39,7 +57,7 @@ export default class ExNavigator extends React.Component {
...Navigator.defaultProps,
showNavigationBar: true,
renderNavigationBar: props => {
return <Navigator.NavigationBar {...props} />
return <NavigationBar {...props} />
},
};

Expand Down