Skip to content

Commit

Permalink
Merge pull request #163 from aksonov/delian-tap-tabs
Browse files Browse the repository at this point in the history
Tap on tab to go to home
  • Loading branch information
Pavlo Aksonov committed Feb 1, 2016
2 parents 5d9d3bd + 6d21170 commit 46d97a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ npm i react-native-router-flux --save
| schema | string | optional | Set this property to the name of a previously defined `Schema` to inherit its properties |
| wrapRouter | bool | false | If `true`, the route is automatically nested in its own `Router`. Useful for modal screens. For type==switch wrapRouter will be true|
| sceneConfig | Navigator.SceneConfigs | optional | Defines the transition animation. |
| defaultRoute | string | optional | Defines which route to go to if this route is used as a tab and the tab is clicked on when the tab is already selected |

##### Schema:

Expand Down
6 changes: 5 additions & 1 deletion TabBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ export default class TabBar extends React.Component {
if (!Actions[el.props.name]){
throw new Error("No action is defined for name="+el.props.name+" actions:"+JSON.stringify(Object.keys(Actions)));
}
Actions[el.props.name]();
if (el.props.selected && Actions[el.props.defaultRoute]) {
Actions[el.props.defaultRoute]();
} else {
Actions[el.props.name]();
}
InteractionManager.runAfterInteractions(() =>
this.setState({hideTabBar: el.props.hideTabBar}));
return {selected: true};
Expand Down

0 comments on commit 46d97a6

Please sign in to comment.