Skip to content

Commit 46d97a6

Browse files
author
Pavlo Aksonov
committed
Merge pull request #163 from aksonov/delian-tap-tabs
Tap on tab to go to home
2 parents 5d9d3bd + 6d21170 commit 46d97a6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ npm i react-native-router-flux --save
4444
| schema | string | optional | Set this property to the name of a previously defined `Schema` to inherit its properties |
4545
| 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|
4646
| sceneConfig | Navigator.SceneConfigs | optional | Defines the transition animation. |
47+
| 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 |
4748

4849
##### Schema:
4950

TabBar.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ export default class TabBar extends React.Component {
1111
if (!Actions[el.props.name]){
1212
throw new Error("No action is defined for name="+el.props.name+" actions:"+JSON.stringify(Object.keys(Actions)));
1313
}
14-
Actions[el.props.name]();
14+
if (el.props.selected && Actions[el.props.defaultRoute]) {
15+
Actions[el.props.defaultRoute]();
16+
} else {
17+
Actions[el.props.name]();
18+
}
1519
InteractionManager.runAfterInteractions(() =>
1620
this.setState({hideTabBar: el.props.hideTabBar}));
1721
return {selected: true};

0 commit comments

Comments
 (0)