Browse Source

working skeleton

Daniel Zlotin 8 years ago
parent
commit
e42147721f
4 changed files with 27 additions and 29 deletions
  1. 22
    3
      ios/RNNControllerFactory.m
  2. 3
    3
      package.json
  3. 2
    2
      playground/e2e/app.test.js
  4. 0
    21
      src/commands/LayoutTreeParser.js

+ 22
- 3
ios/RNNControllerFactory.m View File

38
 	return [self.type isEqualToString:@"Tabs"];
38
 	return [self.type isEqualToString:@"Tabs"];
39
 }
39
 }
40
 
40
 
41
+-(BOOL)isSideMenuRoot
42
+{
43
+	return [self.type isEqualToString:@"SideMenuRoot"];
44
+}
45
+
46
+-(BOOL)isSideMenuLeft
47
+{
48
+	return [self.type isEqualToString:@"SideMenuLeft"];
49
+}
50
+
51
+-(BOOL)isSideMenuRight
52
+{
53
+	return [self.type isEqualToString:@"SideMenuRight"];
54
+}
55
+
56
+-(BOOL)isSideMenuCenter
57
+{
58
+	return [self.type isEqualToString:@"SideMenuCenter"];
59
+}
41
 @end
60
 @end
42
 
61
 
43
 @implementation RNNControllerFactory
62
 @implementation RNNControllerFactory
54
 	if (node.isContainer)
73
 	if (node.isContainer)
55
 	{
74
 	{
56
 		return [self createContainer:node];
75
 		return [self createContainer:node];
57
-	} else if(node.isContainerStack)
76
+	} else if (node.isContainerStack)
58
 	{
77
 	{
59
 		return [self createContainerStack:node];
78
 		return [self createContainerStack:node];
60
-	} else if(node.isTabs)
79
+	} else if (node.isTabs)
61
 	{
80
 	{
62
 		return [self createTabs:node];
81
 		return [self createTabs:node];
63
 	}
82
 	}
64
 	
83
 	
65
-	@throw @"unknown container type";
84
+	@throw [NSException exceptionWithName:@"UnknownControllerType" reason:[@"Unknown controller type " stringByAppendingString:node.type] userInfo:nil];
66
 }
85
 }
67
 
86
 
68
 -(UIViewController*)createContainer:(RNNLayoutNode*)node
87
 -(UIViewController*)createContainer:(RNNLayoutNode*)node

+ 3
- 3
package.json View File

76
   "jest": {
76
   "jest": {
77
     "preset": "react-native",
77
     "preset": "react-native",
78
     "testPathDirs": [
78
     "testPathDirs": [
79
-      "node_modules",
80
-      "src",
81
-      "integration"
79
+      "<rootDir>/node_modules/",
80
+      "<rootDir>/src/",
81
+      "<rootDir>/integration/"
82
     ],
82
     ],
83
     "resetMocks": true,
83
     "resetMocks": true,
84
     "resetModules": true
84
     "resetModules": true

+ 2
- 2
playground/e2e/app.test.js View File

12
     expect(elementByLabel('This is a tab screen')).toBeVisible();
12
     expect(elementByLabel('This is a tab screen')).toBeVisible();
13
   });
13
   });
14
 
14
 
15
-  it('switch to tabs with side menus', () => {
15
+  xit('switch to tabs with side menus', () => {
16
     elementById('btnSwitchToTabsWithMenus').tap();
16
     elementById('btnSwitchToTabsWithMenus').tap();
17
-    // expect(elementByLabel('This is a tab screen')).toBeVisible();
17
+    expect(elementByLabel('This is a tab screen')).toBeVisible();
18
   });
18
   });
19
 });
19
 });
20
 
20
 

+ 0
- 21
src/commands/LayoutTreeParser.js View File

40
       ]
40
       ]
41
     });
41
     });
42
     return children;
42
     return children;
43
-
44
-    // (simpleJsonApi.sideMenu, (v, k) => {
45
-    //       if (_.isEqual(k, 'left')) {
46
-    //         return {
47
-    //           type: 'SideMenuLeft',
48
-    //           id: this.uniqueIdProvider.generate('SideMenuLeft'),
49
-    //           children: [
50
-    //             this.createContainer(v)
51
-    //           ]
52
-    //         };
53
-    //       } else if (_.isEqual(k, 'right')) {
54
-    //         return {
55
-    //           type: 'SideMenuRight',
56
-    //           id: this.uniqueIdProvider.generate('SideMenuRight'),
57
-    //           children: [
58
-    //             this.createContainer(v)
59
-    //           ]
60
-    //         };
61
-    //       }
62
-    //       return undefined;
63
-    //     })
64
   }
43
   }
65
 
44
 
66
   createTabs(tabs) {
45
   createTabs(tabs) {