Skip to content

Commit

Permalink
Augment scene and navigation bar methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseruder committed Oct 5, 2015
1 parent 1779cdc commit d37f6ce
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions ExNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ export default class ExNavigator extends React.Component {
});
}

get navigationContext() {
return this._navigator ? this._navigator.navigationContext : null;
}

render() {
return (
<Navigator
Expand All @@ -70,10 +66,11 @@ export default class ExNavigator extends React.Component {
// mounted because it emits a didfocus event when it is mounted, before we
// can get a ref to it
if (!this._subscribedToFocusEvents) {
this._subscribeToFocusEvents(this);
this._subscribeToFocusEvents(navigator);
}

let scene = this._routeRenderer.renderScene(route, this);
scene = this.augmentScene(scene, route);
let firstRoute = navigator.getCurrentRoutes()[0];
if (route === firstRoute) {
scene = cloneReferencedElement(scene, {
Expand All @@ -88,12 +85,14 @@ export default class ExNavigator extends React.Component {
return null;
}

return (
let navigationBar = (
<Navigator.NavigationBar
routeMapper={this._routeRenderer.navigationBarRouteMapper}
style={[ExNavigatorStyles.bar, this.props.navigationBarStyle]}
/>
);

return this.augmentNavigationBar(navigationBar);
}

@autobind
Expand Down Expand Up @@ -186,6 +185,16 @@ export default class ExNavigator extends React.Component {
popToTop() {
return this._navigator.popToTop();
}

// Methods to override

augmentScene(scene, route: ExRoute) {
// Override
}

augmentNavigationBar(navigationBar: Navigator.NavigationBar) {
// Override
}
}

export * from './ExRoute';

0 comments on commit d37f6ce

Please sign in to comment.