diff --git a/ExRouter.js b/ExRouter.js index 52de7e47e..5a1ebaf66 100644 --- a/ExRouter.js +++ b/ExRouter.js @@ -152,7 +152,7 @@ class ExNavigationBar extends Navigator.NavigationBar { if (route.props.hideNavBar === false){ return super.render(); } - if (this.props.router.props.hideNavBar){ + if (this.props.router.props.hideNavBar || route.props.hideNavBar){ return null; } return super.render(); diff --git a/Example/Example.js b/Example/Example.js index eaa5bfdca..7aa23b549 100644 --- a/Example/Example.js +++ b/Example/Example.js @@ -37,9 +37,9 @@ export default class Example extends React.Component { - + - + diff --git a/Router.js b/Router.js index 9bed28441..39f49eb68 100644 --- a/Router.js +++ b/Router.js @@ -9,6 +9,7 @@ import Route from './Route'; import Actions from './Actions'; +import debug from './debug'; export class RouterDelegate { onPush(name:string, props:{ [key: string]: any}):boolean { @@ -34,6 +35,7 @@ export default class Router { schemas: {[key: string]: {[key:string]:any } }; props: { [key: string]: any}; parentRoute: ?Route; + nextRoute: ?Route; _stack: Array; delegate:RouterDelegate; @@ -65,6 +67,8 @@ export default class Router { stack:Array = null, props:{ [key: string]: any} = {}){ this.schemas = {}; this.routes = {}; + this.pop = this.pop.bind(this); + this.route = this.route.bind(this); this.delegate = new RouterDelegate(); if (!routes || !routes.length){ throw new Error("routes is not defined"); @@ -147,10 +151,11 @@ export default class Router { if (!this["_"+action]){ throw new Error("No type="+action+" is supported"); } + this.nextRoute = this.routes[name]; const handler = "on"+capitalizeFirstLetter(action); if (this.delegate[handler]) { - console.log("Run handler "+handler); + debug("Run handler "+handler); const res:boolean = this.delegate[handler](this.routes[name], props); if (!res) { console.log("Ignore push, handler returns false"); @@ -193,6 +198,7 @@ export default class Router { if (this._stack.length <= num){ throw new Error("Cannot pop(), stack=["+this._stack+"]"); } + this.nextRoute = null; if (this.delegate.onPop && this.delegate.onPop(num)){ const routes = this._stack.splice(-num, num); return true;