From acc440abb1593840f0d68eddd8688f8f1d4a9c59 Mon Sep 17 00:00:00 2001 From: Code Date: Tue, 7 Jun 2016 10:56:10 +0800 Subject: [PATCH 1/3] tabs show onPress item Actions._Launch()} /> --- src/Actions.js | 6 ++++-- src/Router.js | 2 +- src/TabBar.js | 6 +++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Actions.js b/src/Actions.js index 4ba9ba53a..1b6d07db7 100644 --- a/src/Actions.js +++ b/src/Actions.js @@ -80,7 +80,7 @@ class Actions { if (!(list instanceof Array)) { list = [list]; } - const condition = el => (!el.props.component && !el.props.children && + const condition = el => (!el.props.component && !el.props.children && !el.props.onPress && (!el.props.type || el.props.type === REFRESH_ACTION)); // determine sub-states let baseKey = root.key; @@ -90,7 +90,9 @@ class Actions { if (list.length) { res.children = list.map(c => this.iterate(c, res, refs).key); } else { - assert(staticProps.component, `component property is not set for key=${key}`); + if (!staticProps.onPress){ + assert(staticProps.component, `component property is not set for key=${key}`); + } // wrap scene if parent is "tabs" if (parentProps.tabs) { const innerKey = `${res.key}_`; diff --git a/src/Router.js b/src/Router.js index 36d836a27..754cdb190 100644 --- a/src/Router.js +++ b/src/Router.js @@ -53,7 +53,7 @@ class Router extends Component { } else { let scenes = props.children; - if (Array.isArray(props.children)) { + if (Array.isArray(props.children) || props.children.props.component) { scenes = ( Date: Tue, 7 Jun 2016 11:44:39 +0800 Subject: [PATCH 2/3] tabs show onPress item Actions._Launch()} /> --- src/Actions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Actions.js b/src/Actions.js index 1b6d07db7..8d85d3368 100644 --- a/src/Actions.js +++ b/src/Actions.js @@ -91,7 +91,7 @@ class Actions { res.children = list.map(c => this.iterate(c, res, refs).key); } else { if (!staticProps.onPress){ - assert(staticProps.component, `component property is not set for key=${key}`); + assert(staticProps.component, `component property is not set for key=${key}`); } // wrap scene if parent is "tabs" if (parentProps.tabs) { From e4dd65c5c78ebb2317b0bf32cb0b412fe21a7c4c Mon Sep 17 00:00:00 2001 From: Code Date: Tue, 7 Jun 2016 11:47:14 +0800 Subject: [PATCH 3/3] tabs show onPress item tabs show onPress item --- src/Actions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Actions.js b/src/Actions.js index 8d85d3368..3cdfcdda6 100644 --- a/src/Actions.js +++ b/src/Actions.js @@ -90,7 +90,7 @@ class Actions { if (list.length) { res.children = list.map(c => this.iterate(c, res, refs).key); } else { - if (!staticProps.onPress){ + if (!staticProps.onPress) { assert(staticProps.component, `component property is not set for key=${key}`); } // wrap scene if parent is "tabs"