Daniel Zlotin 7 yıl önce
ebeveyn
işleme
ab89c02fd2

+ 5
- 0
playground/e2e/app.test.js Dosyayı Görüntüle

@@ -11,6 +11,11 @@ describe('app', () => {
11 11
     elementByLabel('Switch to tab based app').tap();
12 12
     expect(elementByLabel('This is a tab screen')).toBeVisible();
13 13
   });
14
+
15
+  it('switch to tabs with side menus', () => {
16
+    elementByLabel('Switch to tab based app with side menus').tap();
17
+    // expect(elementByLabel('This is a tab screen')).toBeVisible();
18
+  });
14 19
 });
15 20
 
16 21
 function elementByLabel(label) {

+ 31
- 0
playground/src/containers/WelcomeScreen.js Dosyayı Görüntüle

@@ -9,6 +9,7 @@ class WelcomeScreen extends Component {
9 9
       <View style={styles.root}>
10 10
         <Text style={styles.h1}>{`React Native Navigation!`}</Text>
11 11
         <Button title="Switch to tab based app" onPress={this.onClickSwitchToTabs} />
12
+        <Button title="Switch to tab based app with side menus" onPress={this.onClickSwitchToTabsWithSideMenus} />
12 13
       </View>
13 14
     );
14 15
   }
@@ -29,6 +30,36 @@ class WelcomeScreen extends Component {
29 30
       ]
30 31
     });
31 32
   }
33
+
34
+  onClickSwitchToTabsWithSideMenus() {
35
+    Navigation.startApp({
36
+      tabs: [
37
+        {
38
+          container: {
39
+            name: 'com.example.SimpleTabScreen'
40
+          }
41
+        },
42
+        {
43
+          container: {
44
+            name: 'com.example.WelcomeScreen'
45
+          }
46
+        },
47
+        {
48
+          container: {
49
+            name: 'com.example.SimpleTabScreen'
50
+          }
51
+        }
52
+      ],
53
+      sideMenu: {
54
+        left: {
55
+          name: 'com.example.SimpleTabScreen'
56
+        },
57
+        right: {
58
+          name: 'com.example.SimpleTabScreen'
59
+        }
60
+      }
61
+    });
62
+  }
32 63
 }
33 64
 
34 65
 export default WelcomeScreen;

+ 29
- 30
src/commands/LayoutTreeParser.test.js Dosyayı Görüntüle

@@ -125,35 +125,34 @@ describe('LayoutTreeParser', () => {
125 125
   });
126 126
 
127 127
   xit('parses side menus', () => {
128
-    //const result2 = {
129
-    //  type: 'Menus',
130
-    //  id: 'MenusUNIQUE_ID',
131
-    //  children: [
132
-    //    {
133
-    //      type: 'Container',
134
-    //      id: 'ContainerUNIQUE_ID',
135
-    //      name: 'com.example.LeftSideMenu',
136
-    //      children: []
137
-    //    },
138
-    //    {
139
-    //      type: 'ContainerStack',
140
-    //      id: 'ContainerStackUNIQUE_ID',
141
-    //      children: [
142
-    //        {
143
-    //          type: 'Container',
144
-    //          id: 'ContainerUNIQUE_ID',
145
-    //          name: 'com.example.WelcomeScreen',
146
-    //          children: []
147
-    //        }
148
-    //      ]
149
-    //    },
150
-    //    {
151
-    //      type: 'Container',
152
-    //      id: 'ContainerUNIQUE_ID',
153
-    //      name: 'com.example.RightSideMenu',
154
-    //      children: []
155
-    //    }
156
-    //  ]
157
-    //};
128
+    expect(uut.parseFromSimpleJSON(SimpleLayouts.singleWithSideMenu))
129
+      .toEqual({
130
+        type: 'SideMenus',
131
+        id: 'SideMenus+UNIQUE_ID',
132
+        children: [
133
+          {
134
+            type: 'Container',
135
+            id: 'Container+UNIQUE_ID',
136
+            data: {
137
+              name: 'com.example.SideMenu'
138
+            },
139
+            children: []
140
+          },
141
+          {
142
+            type: 'ContainerStack',
143
+            id: 'ContainerStack+UNIQUE_ID',
144
+            children: [
145
+              {
146
+                type: 'Container',
147
+                id: 'Container+UNIQUE_ID',
148
+                data: {
149
+                  name: 'com.example.MyScreen'
150
+                },
151
+                children: []
152
+              }
153
+            ]
154
+          }
155
+        ]
156
+      });
158 157
   });
159 158
 });

+ 1
- 1
src/commands/SimpleLayouts.js Dosyayı Görüntüle

@@ -48,7 +48,7 @@ export const singleWithSideMenu = {
48 48
   sideMenu: {
49 49
     left: {
50 50
       container: {
51
-        name: 'com.example.MyScreen'
51
+        name: 'com.example.SideMenu'
52 52
       }
53 53
     }
54 54
   }