Browse Source

working skeleton

Daniel Zlotin 7 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,6 +38,25 @@
38 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 60
 @end
42 61
 
43 62
 @implementation RNNControllerFactory
@@ -54,15 +73,15 @@
54 73
 	if (node.isContainer)
55 74
 	{
56 75
 		return [self createContainer:node];
57
-	} else if(node.isContainerStack)
76
+	} else if (node.isContainerStack)
58 77
 	{
59 78
 		return [self createContainerStack:node];
60
-	} else if(node.isTabs)
79
+	} else if (node.isTabs)
61 80
 	{
62 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 87
 -(UIViewController*)createContainer:(RNNLayoutNode*)node

+ 3
- 3
package.json View File

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

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

@@ -12,9 +12,9 @@ describe('app', () => {
12 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 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,27 +40,6 @@ export default class LayoutTreeParser {
40 40
       ]
41 41
     });
42 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 45
   createTabs(tabs) {