|
@@ -6,6 +6,8 @@ const { View, Text, Button } = require('react-native');
|
6
|
6
|
const Navigation = require('react-native-navigation');
|
7
|
7
|
const testIDs = require('../testIDs');
|
8
|
8
|
|
|
9
|
+let globalFirstContainerID;
|
|
10
|
+
|
9
|
11
|
class TextScreen extends Component {
|
10
|
12
|
static get navigationOptions() {
|
11
|
13
|
return {
|
|
@@ -15,6 +17,11 @@ class TextScreen extends Component {
|
15
|
17
|
};
|
16
|
18
|
}
|
17
|
19
|
|
|
20
|
+ constructor(props) {
|
|
21
|
+ super(props);
|
|
22
|
+ globalFirstContainerID = (props.text === 'This is tab 1') ? props.containerId : globalFirstContainerID;
|
|
23
|
+ }
|
|
24
|
+
|
18
|
25
|
render() {
|
19
|
26
|
return (
|
20
|
27
|
<View style={styles.root}>
|
|
@@ -23,6 +30,7 @@ class TextScreen extends Component {
|
23
|
30
|
<Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
|
24
|
31
|
<Button title={'Set Tab Badge'} testID={testIDs.SET_TAB_BADGE_BUTTON} onPress={() => this.onButtonPress()} />
|
25
|
32
|
<Button title={'Switch To Tab 2'} testID={testIDs.SWITCH_SECOND_TAB_BUTTON} onPress={() => this.onClickSwitchToTab()} />
|
|
33
|
+ <Button title={'Switch To Tab 1 by containerID'} testID={testIDs.SWITCH_FIRST_TAB_BUTTON} onPress={() => this.onClickSwitchToTabByContainerID()} />
|
26
|
34
|
<Button title="Hide Tab Bar" testID={testIDs.HIDE_BOTTOM_TABS_BUTTON} onPress={() => this.hideTabBar(true)} />
|
27
|
35
|
<Button title="Show Tab Bar" testID={testIDs.SHOW_BOTTOM_TABS_BUTTON} onPress={() => this.hideTabBar(false)} />
|
28
|
36
|
<Button title="Show Left Side Menu" testID={testIDs.SHOW_LEFT_SIDE_MENU_BUTTON} onPress={() => this.showSideMenu('left')} />
|
|
@@ -58,6 +66,14 @@ class TextScreen extends Component {
|
58
|
66
|
});
|
59
|
67
|
}
|
60
|
68
|
|
|
69
|
+ onClickSwitchToTabByContainerID() {
|
|
70
|
+ Navigation.setOptions(this.props.containerId, {
|
|
71
|
+ bottomTabs: {
|
|
72
|
+ currentTabId: globalFirstContainerID
|
|
73
|
+ }
|
|
74
|
+ });
|
|
75
|
+ }
|
|
76
|
+
|
61
|
77
|
hideTabBar(hidden) {
|
62
|
78
|
Navigation.setOptions(this.props.containerId, {
|
63
|
79
|
bottomTabs: {
|