Przeglądaj źródła

renamed container to component

Daniel Zlotin 7 lat temu
rodzic
commit
4d1b188ba0

+ 0
- 1
lib/src/commands/Commands.test.js Wyświetl plik

@@ -1,4 +1,3 @@
1
-const SimpleLayouts = require('./SimpleLayouts');
2 1
 const LayoutTreeParser = require('./LayoutTreeParser');
3 2
 const LayoutTreeCrawler = require('./LayoutTreeCrawler');
4 3
 const Store = require('../containers/Store');

+ 108
- 0
lib/src/commands/Examples.js Wyświetl plik

@@ -0,0 +1,108 @@
1
+const passProps = {
2
+  strProp: 'string prop',
3
+  numProp: 12345,
4
+  objProp: { inner: { foo: 'bar' } },
5
+  fnProp: () => 'Hello from a function'
6
+};
7
+
8
+const topBarOptions = {
9
+  topBar: {
10
+    title: 'Hello1'
11
+  }
12
+};
13
+
14
+const singleComponent = {
15
+  component: {
16
+    name: 'myReactComponent'
17
+  }
18
+};
19
+
20
+const stackOfComponentsWithTopBar = {
21
+  stack: [
22
+    {
23
+      component: {
24
+        name: 'myReactComponent1'
25
+      }
26
+    },
27
+
28
+    {
29
+      component: {
30
+        name: 'myReactComponent2',
31
+        options: topBarOptions // optional
32
+      }
33
+    }
34
+  ]
35
+};
36
+
37
+const bottomTabs = {
38
+  bottomTabs: [
39
+    stackOfComponentsWithTopBar,
40
+    stackOfComponentsWithTopBar,
41
+    {
42
+      component: {
43
+        name: 'myReactComponent1'
44
+      }
45
+    }
46
+  ]
47
+};
48
+
49
+const sideMenu = {
50
+  sideMenu: {
51
+    left: singleComponent,
52
+    center: stackOfComponentsWithTopBar,
53
+    right: singleComponent
54
+  }
55
+};
56
+
57
+const topTabs = {
58
+  topTabs: [
59
+    singleComponent,
60
+    singleComponent,
61
+    singleComponent,
62
+    singleComponent,
63
+    stackOfComponentsWithTopBar
64
+  ],
65
+  options: topBarOptions
66
+};
67
+
68
+const complexLayout = {
69
+  sideMenu: {
70
+    left: singleComponent,
71
+    center: {
72
+      bottomTabs: [
73
+        stackOfComponentsWithTopBar,
74
+        stackOfComponentsWithTopBar,
75
+        {
76
+          stack: [
77
+            {
78
+              topTabs: [
79
+                {
80
+                  topTabs: [
81
+                    singleComponent,
82
+                    singleComponent,
83
+                    singleComponent,
84
+                    singleComponent,
85
+                    stackOfComponentsWithTopBar
86
+                  ],
87
+                  options: topBarOptions
88
+                },
89
+                stackOfComponentsWithTopBar,
90
+                stackOfComponentsWithTopBar
91
+              ]
92
+            }
93
+          ]
94
+        }
95
+      ]
96
+    }
97
+  }
98
+};
99
+
100
+module.exports = {
101
+  passProps,
102
+  topBarOptions,
103
+  singleComponent,
104
+  bottomTabs,
105
+  sideMenu,
106
+  topTabs,
107
+  complexLayout
108
+};

+ 0
- 1
lib/src/commands/LayoutTreeParser.test.js Wyświetl plik

@@ -1,4 +1,3 @@
1
-const SimpleLayouts = require('./SimpleLayouts');
2 1
 const LayoutTreeParser = require('./LayoutTreeParser');
3 2
 
4 3
 describe('LayoutTreeParser', () => {

+ 2
- 3
lib/src/commands/LayoutTypes.js Wyświetl plik

@@ -1,12 +1,11 @@
1 1
 module.exports = {
2
-  Container: 'Container',
3
-  ContainerStack: 'ContainerStack',
2
+  Component: 'Component',
3
+  ComponentStack: 'ComponentStack',
4 4
   BottomTabs: 'BottomTabs',
5 5
   SideMenuRoot: 'SideMenuRoot',
6 6
   SideMenuCenter: 'SideMenuCenter',
7 7
   SideMenuLeft: 'SideMenuLeft',
8 8
   SideMenuRight: 'SideMenuRight',
9
-  CustomDialog: 'CustomDialog',
10 9
   TopTabs: 'TopTabs',
11 10
   TopTab: 'TopTab'
12 11
 };

+ 0
- 138
lib/src/commands/SimpleLayouts.js Wyświetl plik

@@ -1,138 +0,0 @@
1
-const singleScreenApp = {
2
-  container: {
3
-    name: 'com.example.MyScreen'
4
-  }
5
-};
6
-
7
-const passProps = {
8
-  strProp: 'string prop',
9
-  numProp: 12345,
10
-  objProp: { inner: { foo: 'bar' } },
11
-  fnProp: () => 'Hello from a function'
12
-};
13
-
14
-const singleScreenWithAditionalParams = {
15
-  container: {
16
-    name: 'com.example.MyScreen',
17
-    passProps,
18
-    style: {},
19
-    buttons: {}
20
-  }
21
-};
22
-
23
-const tabBasedApp = {
24
-  bottomTabs: [
25
-    {
26
-      container: {
27
-        name: 'com.example.ATab'
28
-      }
29
-    },
30
-    {
31
-      container: {
32
-        name: 'com.example.SecondTab'
33
-      }
34
-    },
35
-    {
36
-      container: {
37
-        name: 'com.example.ATab'
38
-      }
39
-    }
40
-  ]
41
-};
42
-
43
-const singleWithSideMenu = {
44
-  container: {
45
-    name: 'com.example.MyScreen'
46
-  },
47
-  sideMenu: {
48
-    left: {
49
-      container: {
50
-        name: 'com.example.SideMenu'
51
-      }
52
-    }
53
-  }
54
-};
55
-
56
-const singleWithRightSideMenu = {
57
-  container: {
58
-    name: 'com.example.MyScreen'
59
-  },
60
-  sideMenu: {
61
-    right: {
62
-      container: {
63
-        name: 'com.example.SideMenu'
64
-      }
65
-    }
66
-  }
67
-};
68
-
69
-const singleWithBothMenus = {
70
-  container: {
71
-    name: 'com.example.MyScreen'
72
-  },
73
-  sideMenu: {
74
-    left: {
75
-      container: {
76
-        name: 'com.example.Menu1'
77
-      }
78
-    },
79
-    right: {
80
-      container: {
81
-        name: 'com.example.Menu2'
82
-      }
83
-    }
84
-  }
85
-};
86
-
87
-const tabBasedWithBothSideMenus = {
88
-  bottomTabs: [
89
-    {
90
-      container: {
91
-        name: 'com.example.FirstTab'
92
-      }
93
-    },
94
-    {
95
-      container: {
96
-        name: 'com.example.SecondTab'
97
-      }
98
-    }
99
-  ],
100
-  sideMenu: {
101
-    left: {
102
-      container: {
103
-        name: 'com.example.Menu1'
104
-      }
105
-    },
106
-    right: {
107
-      container: {
108
-        name: 'com.example.Menu2'
109
-      }
110
-    }
111
-  }
112
-};
113
-
114
-const singleScreenWithTopTabs = {
115
-  topTabs: [
116
-    {
117
-      name: 'navigation.playground.TextScreen'
118
-    },
119
-    {
120
-      name: 'navigation.playground.TextScreen'
121
-    },
122
-    {
123
-      name: 'navigation.playground.TextScreen'
124
-    }
125
-  ]
126
-};
127
-
128
-module.exports = {
129
-  singleScreenApp,
130
-  passProps,
131
-  singleScreenWithAditionalParams,
132
-  tabBasedApp,
133
-  singleWithSideMenu,
134
-  singleWithRightSideMenu,
135
-  singleWithBothMenus,
136
-  tabBasedWithBothSideMenus,
137
-  singleScreenWithTopTabs
138
-};