Daniel Zlotin 6 лет назад
Родитель
Сommit
2f4ede0bde

+ 9
- 0
e2e/ScreenStack.test.js Просмотреть файл

@@ -98,4 +98,13 @@ describe('screen stack', () => {
98 98
     await elementById(testIDs.POP_BUTTON).tap();
99 99
     await expect(elementByLabel('Stack Position: 2')).toBeVisible();
100 100
   });
101
+
102
+  it(':android: push to stack with static id from SideMenu', async () => {
103
+    await elementById(testIDs.TAB_BASED_APP_SIDE_BUTTON).tap();
104
+    await elementById(testIDs.SHOW_LEFT_SIDE_MENU_BUTTON).tap();
105
+    await elementById(testIDs.LEFT_SIDE_MENU_PUSH_BUTTON).tap();
106
+    await expect(elementByLabel('Text Screen')).toBeVisible();
107
+    await elementById(testIDs.POP_BUTTON).tap();
108
+    await expect(elementByLabel('This is a side menu center screen tab 1')).toBeVisible();
109
+  });
101 110
 });

+ 10
- 0
playground/src/screens/SideMenuScreen.js Просмотреть файл

@@ -15,6 +15,7 @@ class SideMenuScreen extends Component {
15 15
         <Text testID={testIDs.SIDE_BAR}>Side Bar</Text>
16 16
         <Text style={styles.h1}>{`This is a ${this.props.side} side menu screen`}</Text>
17 17
         <Button title='Hide Side Menu' testID={testID} onPress={() => this.hideSideMenu()} />
18
+        <Button title='Push' testID={this.props.side + testIDs.SIDE_MENU_PUSH_BUTTON} onPress={() => this.pushAndCloseSideMenu()} />
18 19
       </View>
19 20
     );
20 21
   }
@@ -28,6 +29,15 @@ class SideMenuScreen extends Component {
28 29
       }
29 30
     });
30 31
   }
32
+
33
+  pushAndCloseSideMenu() {
34
+    this.hideSideMenu();
35
+    Navigation.push('tab1Stack', {
36
+      component: {
37
+        name: 'navigation.playground.TextScreen'
38
+      }
39
+    });
40
+  }
31 41
 }
32 42
 module.exports = SideMenuScreen;
33 43
 

+ 1
- 0
playground/src/screens/WelcomeScreen.js Просмотреть файл

@@ -153,6 +153,7 @@ class WelcomeScreen extends Component {
153 153
               children: [
154 154
                 {
155 155
                   stack: {
156
+                    id: 'tab1Stack',
156 157
                     children: [
157 158
                       {
158 159
                         component: {

+ 3
- 0
playground/src/testIDs.js Просмотреть файл

@@ -7,6 +7,9 @@ module.exports = {
7 7
   PUSH_LIFECYCLE_BUTTON: `PUSH_LIFECYCLE_BUTTON`,
8 8
   PUSH_STATIC_LIFECYCLE_BUTTON: `PUSH_STATIC_LIFECYCLE_BUTTON`,
9 9
   PUSH_BUTTON: `PUSH_BUTTON`,
10
+  SIDE_MENU_PUSH_BUTTON: `SIDE_MENU_PUSH_BUTTON`,
11
+  LEFT_SIDE_MENU_PUSH_BUTTON: `leftSIDE_MENU_PUSH_BUTTON`,
12
+  RIGHT_SIDE_MENU_PUSH_BUTTON: `rightSIDE_MENU_PUSH_BUTTON`,
10 13
   PUSH_OPTIONS_BUTTON: `PUSH_OPTIONS_BUTTON`,
11 14
   PUSH_DEFAULT_OPTIONS_BUTTON: `PUSH_DEFAULT_OPTIONS_BUTTON`,
12 15
   SHOW_TOPBAR_REACT_VIEW: `SHOW_TOPBAR_REACT_VIEW`,