瀏覽代碼

Add basic documentation structure (#2386)

Guy Carmeli 7 年之前
父節點
當前提交
1163868843
No account linked to committer's email address

+ 12
- 0
docs/docs/BottomTabs.md 查看文件

1
+<a name="BottomTabs"></a>
2
+
3
+## BottomTabs
4
+**Properties**
5
+
6
+| Name | Type |
7
+| --- | --- |
8
+| tabs | <code>Array.&lt;Container&gt;</code> | 
9
+
10
+
11
+* * *
12
+

+ 19
- 0
docs/docs/Button.md 查看文件

1
+<a name="Button"></a>
2
+
3
+## Button
4
+**Properties**
5
+
6
+| Name | Type |
7
+| --- | --- |
8
+| id | <code>String</code> | 
9
+| testID | <code>string</code> | 
10
+| title | <code>string</code> | 
11
+| buttonColor | <code>string</code> | 
12
+| showAsAction | <code>string</code> | 
13
+| buttonFontWeight | <code>int</code> | 
14
+| disableIconTint | <code>boolean</code> | 
15
+| disabled | <code>boolean</code> | 
16
+
17
+
18
+* * *
19
+

+ 13
- 0
docs/docs/Container.md 查看文件

1
+<a name="Container"></a>
2
+
3
+## Container
4
+**Properties**
5
+
6
+| Name | Type | Description |
7
+| --- | --- | --- |
8
+| name | <code>string</code> | The container's registered name |
9
+| passProps | <code>Object</code> | props |
10
+
11
+
12
+* * *
13
+

+ 119
- 1
docs/docs/Navigation.md 查看文件

5
 * [Navigation](#Navigation)
5
 * [Navigation](#Navigation)
6
     * [.registerContainer(containerName, getContainerFunc)](#Navigation+registerContainer)
6
     * [.registerContainer(containerName, getContainerFunc)](#Navigation+registerContainer)
7
     * [.setRoot(root)](#Navigation+setRoot)
7
     * [.setRoot(root)](#Navigation+setRoot)
8
+    * [.setDefaultOptions(options)](#Navigation+setDefaultOptions)
8
     * [.setOptions(containerId, options)](#Navigation+setOptions)
9
     * [.setOptions(containerId, options)](#Navigation+setOptions)
10
+    * [.showModal(params)](#Navigation+showModal)
11
+    * [.dismissModal(containerId)](#Navigation+dismissModal)
12
+    * [.dismissAllModals()](#Navigation+dismissAllModals)
13
+    * [.push(containerId, params)](#Navigation+push)
14
+    * [.pop(containerId, params)](#Navigation+pop)
15
+    * [.popTo(containerId)](#Navigation+popTo)
16
+    * [.popToRoot(containerId)](#Navigation+popToRoot)
17
+    * [.events()](#Navigation+events)
9
 
18
 
10
 
19
 
11
 * * *
20
 * * *
35
 | root | <code>Root</code> | 
44
 | root | <code>Root</code> | 
36
 
45
 
37
 
46
 
47
+* * *
48
+
49
+<a name="Navigation+setDefaultOptions"></a>
50
+
51
+### navigation.setDefaultOptions(options)
52
+Set default options to all screens. Useful for declaring a consistent style across the app.
53
+
54
+
55
+| Param | Type |
56
+| --- | --- |
57
+| options | <code>NavigationOptions</code> | 
58
+
59
+
38
 * * *
60
 * * *
39
 
61
 
40
 <a name="Navigation+setOptions"></a>
62
 <a name="Navigation+setOptions"></a>
45
 
67
 
46
 | Param | Type | Description |
68
 | Param | Type | Description |
47
 | --- | --- | --- |
69
 | --- | --- | --- |
48
-| containerId | <code>string</code> | Unique container name |
70
+| containerId | <code>string</code> | The container's id. |
49
 | options | <code>NavigationOptions</code> |  |
71
 | options | <code>NavigationOptions</code> |  |
50
 
72
 
51
 
73
 
52
 * * *
74
 * * *
53
 
75
 
76
+<a name="Navigation+showModal"></a>
77
+
78
+### navigation.showModal(params)
79
+Show a screen as a modal.
80
+
81
+
82
+| Param | Type |
83
+| --- | --- |
84
+| params | <code>Object</code> | 
85
+
86
+
87
+* * *
88
+
89
+<a name="Navigation+dismissModal"></a>
90
+
91
+### navigation.dismissModal(containerId)
92
+Dismiss a modal by containerId. The dismissed modal can be anywhere in the stack.
93
+
94
+
95
+| Param | Type | Description |
96
+| --- | --- | --- |
97
+| containerId | <code>String</code> | The container's id. |
98
+
99
+
100
+* * *
101
+
102
+<a name="Navigation+dismissAllModals"></a>
103
+
104
+### navigation.dismissAllModals()
105
+Dismiss all Modals
106
+
107
+
108
+* * *
109
+
110
+<a name="Navigation+push"></a>
111
+
112
+### navigation.push(containerId, params)
113
+Push a new screen into this screen's navigation stack.
114
+
115
+
116
+| Param | Type | Description |
117
+| --- | --- | --- |
118
+| containerId | <code>String</code> | The container's id. |
119
+| params | <code>\*</code> |  |
120
+
121
+
122
+* * *
123
+
124
+<a name="Navigation+pop"></a>
125
+
126
+### navigation.pop(containerId, params)
127
+Pop a container from the stack, regardless of it's position.
128
+
129
+
130
+| Param | Type | Description |
131
+| --- | --- | --- |
132
+| containerId | <code>String</code> | The container's id. |
133
+| params | <code>\*</code> |  |
134
+
135
+
136
+* * *
137
+
138
+<a name="Navigation+popTo"></a>
139
+
140
+### navigation.popTo(containerId)
141
+Pop the stack to a given container
142
+
143
+
144
+| Param | Type | Description |
145
+| --- | --- | --- |
146
+| containerId | <code>String</code> | The container's id. |
147
+
148
+
149
+* * *
150
+
151
+<a name="Navigation+popToRoot"></a>
152
+
153
+### navigation.popToRoot(containerId)
154
+Pop the container's stack to root.
155
+
156
+
157
+| Param | Type |
158
+| --- | --- |
159
+| containerId | <code>\*</code> | 
160
+
161
+
162
+* * *
163
+
164
+<a name="Navigation+events"></a>
165
+
166
+### navigation.events()
167
+Obtain the events registery instance
168
+
169
+
170
+* * *
171
+

+ 24
- 0
docs/docs/NavigationOptions.md 查看文件

1
+<a name="exp_module_NavigationOptions--NavigationOptions"></a>
2
+
3
+## NavigationOptions ⏏
4
+NavigationOptions are used by containers to customize their behavior and style.
5
+
6
+
7
+* * *
8
+
9
+<a name="module_NavigationOptions--NavigationOptions..NavigationOptions"></a>
10
+
11
+### NavigationOptions~NavigationOptions : <code>Object</code>
12
+**Properties**
13
+
14
+| Name | Type |
15
+| --- | --- |
16
+| topBar | <code>TopBar</code> | 
17
+| bottomTabs | <code>TabBar</code> | 
18
+| orientation | <code>String</code> | 
19
+| rightButtons | <code>Button</code> | 
20
+| leftButtons | <code>Button</code> | 
21
+
22
+
23
+* * *
24
+

+ 14
- 0
docs/docs/Root.md 查看文件

1
+<a name="Root"></a>
2
+
3
+## Root
4
+**Properties**
5
+
6
+| Name | Type |
7
+| --- | --- |
8
+| container | <code>Container</code> | 
9
+| sideMenu | <code>SideMenu</code> | 
10
+| bottomTabs | <code>BottomTabs</code> | 
11
+
12
+
13
+* * *
14
+

+ 13
- 0
docs/docs/SideMenu.md 查看文件

1
+<a name="SideMenu"></a>
2
+
3
+## SideMenu
4
+**Properties**
5
+
6
+| Name | Type |
7
+| --- | --- |
8
+| left | <code>Container</code> | 
9
+| right | <code>Container</code> | 
10
+
11
+
12
+* * *
13
+

+ 16
- 0
docs/docs/TabBar.md 查看文件

1
+<a name="TabBar"></a>
2
+
3
+## TabBar
4
+**Properties**
5
+
6
+| Name | Type |
7
+| --- | --- |
8
+| currentTabId | <code>string</code> | 
9
+| currentTabIndex | <code>number</code> | 
10
+| tabBadge | <code>number</code> | 
11
+| hidden | <code>boolean</code> | 
12
+| animateHide | <code>boolean</code> | 
13
+
14
+
15
+* * *
16
+

+ 20
- 0
docs/docs/TopBar.md 查看文件

1
+<a name="TopBar"></a>
2
+
3
+## TopBar
4
+**Properties**
5
+
6
+| Name | Type |
7
+| --- | --- |
8
+| title | <code>string</code> | 
9
+| backgroundColor | <code>color</code> | 
10
+| textColor | <code>color</code> | 
11
+| textFontSize | <code>number</code> | 
12
+| textFontFamily | <code>string</code> | 
13
+| hidden | <code>boolean</code> | 
14
+| animateHide | <code>boolean</code> | 
15
+| hideOnScroll | <code>boolean</code> | 
16
+| transparent | <code>boolean</code> | 
17
+
18
+
19
+* * *
20
+

+ 39
- 3
lib/src/Navigation.js 查看文件

46
     return this.commands.setRoot(new Root(params));
46
     return this.commands.setRoot(new Root(params));
47
   }
47
   }
48
 
48
 
49
+  /**
50
+   * Set default options to all screens. Useful for declaring a consistent style across the app.
51
+   * @param {NavigationOptions} options
52
+   */
49
   setDefaultOptions(options) {
53
   setDefaultOptions(options) {
50
     this.commands.setDefaultOptions(options);
54
     this.commands.setDefaultOptions(options);
51
   }
55
   }
52
 
56
 
53
   /**
57
   /**
54
    * Change a containers navigation options
58
    * Change a containers navigation options
55
-   * @param {string} containerId Unique container name
59
+   * @param {string} containerId The container's id.
56
    * @param {NavigationOptions} options
60
    * @param {NavigationOptions} options
57
    */
61
    */
58
   setOptions(containerId, options) {
62
   setOptions(containerId, options) {
59
     this.commands.setOptions(containerId, new NavigationOptions(options));
63
     this.commands.setOptions(containerId, new NavigationOptions(options));
60
   }
64
   }
61
 
65
 
66
+  /**
67
+   * Show a screen as a modal.
68
+   * @param {Object} params 
69
+   */
62
   showModal(params) {
70
   showModal(params) {
63
     return this.commands.showModal(params);
71
     return this.commands.showModal(params);
64
   }
72
   }
65
 
73
 
74
+  /**
75
+   * Dismiss a modal by containerId. The dismissed modal can be anywhere in the stack.
76
+   * @param {String} containerId The container's id.
77
+   */
66
   dismissModal(containerId) {
78
   dismissModal(containerId) {
67
     return this.commands.dismissModal(containerId);
79
     return this.commands.dismissModal(containerId);
68
   }
80
   }
69
 
81
 
82
+  /**
83
+   * Dismiss all Modals
84
+   */
70
   dismissAllModals() {
85
   dismissAllModals() {
71
     return this.commands.dismissAllModals();
86
     return this.commands.dismissAllModals();
72
   }
87
   }
73
 
88
 
74
-  push(onContainerId, params) {
75
-    return this.commands.push(onContainerId, params);
89
+  /**
90
+   * Push a new screen into this screen's navigation stack.
91
+   * @param {String} containerId The container's id.
92
+   * @param {*} params 
93
+   */
94
+  push(containerId, params) {
95
+    return this.commands.push(containerId, params);
76
   }
96
   }
77
 
97
 
98
+  /**
99
+   * Pop a container from the stack, regardless of it's position.
100
+   * @param {String} containerId The container's id.
101
+   * @param {*} params 
102
+   */
78
   pop(containerId, params) {
103
   pop(containerId, params) {
79
     return this.commands.pop(containerId, params);
104
     return this.commands.pop(containerId, params);
80
   }
105
   }
81
 
106
 
107
+  /**
108
+   * Pop the stack to a given container
109
+   * @param {String} containerId The container's id.
110
+   */
82
   popTo(containerId) {
111
   popTo(containerId) {
83
     return this.commands.popTo(containerId);
112
     return this.commands.popTo(containerId);
84
   }
113
   }
85
 
114
 
115
+  /**
116
+   * Pop the container's stack to root.
117
+   * @param {*} containerId 
118
+   */
86
   popToRoot(containerId) {
119
   popToRoot(containerId) {
87
     return this.commands.popToRoot(containerId);
120
     return this.commands.popToRoot(containerId);
88
   }
121
   }
89
 
122
 
123
+  /**
124
+   * Obtain the events registery instance
125
+   */
90
   events() {
126
   events() {
91
     return this.publicEventsRegistry;
127
     return this.publicEventsRegistry;
92
   }
128
   }

+ 0
- 2
lib/src/params/BottomTabs.js 查看文件

3
 
3
 
4
 class BottomTabs {
4
 class BottomTabs {
5
   /**
5
   /**
6
-   * @constructor
7
-   * @typedef {Object} BottomTabs
8
    * @property {Container[]} tabs
6
    * @property {Container[]} tabs
9
    */
7
    */
10
   constructor(tabs) {
8
   constructor(tabs) {

+ 0
- 1
lib/src/params/Container.js 查看文件

1
 class Container {
1
 class Container {
2
   /**
2
   /**
3
-   * @typedef {Object} Container
4
    * @property {string} name The container's registered name
3
    * @property {string} name The container's registered name
5
    * @property {Object} [passProps] props
4
    * @property {Object} [passProps] props
6
    */
5
    */

+ 0
- 1
lib/src/params/Root.js 查看文件

4
 
4
 
5
 class Root {
5
 class Root {
6
   /**
6
   /**
7
-   * @typedef {Object} Root
8
    * @property {Container} container
7
    * @property {Container} container
9
    * @property {SideMenu} [sideMenu]
8
    * @property {SideMenu} [sideMenu]
10
    * @property {BottomTabs} [bottomTabs]
9
    * @property {BottomTabs} [bottomTabs]

+ 0
- 1
lib/src/params/SideMenu.js 查看文件

2
 
2
 
3
 class SideMenu {
3
 class SideMenu {
4
   /**
4
   /**
5
-  * @typedef {Object} SideMenu
6
   * @property {Container} [left]
5
   * @property {Container} [left]
7
   * @property {Container} [right]
6
   * @property {Container} [right]
8
   */
7
   */

+ 0
- 1
lib/src/params/TabBar.js 查看文件

2
 
2
 
3
 class TabBar {
3
 class TabBar {
4
   /**
4
   /**
5
-   * @typedef {Object} TabBar
6
    * @property {string} [currentTabId]
5
    * @property {string} [currentTabId]
7
    * @property {number} [currentTabIndex]
6
    * @property {number} [currentTabIndex]
8
    * @property {number} [tabBadge]
7
    * @property {number} [tabBadge]

+ 0
- 1
lib/src/params/TopBar.js 查看文件

1
 class TopBar {
1
 class TopBar {
2
   /**
2
   /**
3
-   * @typedef {Object} TopBar
4
    * @property {string} [title]
3
    * @property {string} [title]
5
    * @property {color} [backgroundColor]
4
    * @property {color} [backgroundColor]
6
    * @property {color} [textColor]
5
    * @property {color} [textColor]

+ 9
- 2
scripts/generate-js-doc.js 查看文件

2
 const fs = require('fs');
2
 const fs = require('fs');
3
 const path = require('path');
3
 const path = require('path');
4
 
4
 
5
-const inputFiles = ['./lib/src/params/NavigationOptions.js', './lib/src/Navigation.js'];
5
+const paramsDir = './lib/src/params/';
6
 const outputDir = './docs/docs/';
6
 const outputDir = './docs/docs/';
7
 const partial = ['./docs/templates/scope.hbs', './docs/templates/docs.hbs'];
7
 const partial = ['./docs/templates/scope.hbs', './docs/templates/docs.hbs'];
8
 
8
 
35
   fs.writeFileSync(path.resolve(outputDir, `${className}.md`), output);
35
   fs.writeFileSync(path.resolve(outputDir, `${className}.md`), output);
36
 }
36
 }
37
 
37
 
38
-inputFiles.forEach((inputFile) => generateMarkdownForFile(inputFile));
38
+function inputFiles() {
39
+  return [
40
+    './lib/src/Navigation.js',
41
+    ...fs.readdirSync(paramsDir).map((file) => paramsDir + file)
42
+  ];
43
+}
44
+
45
+inputFiles().forEach((inputFile) => generateMarkdownForFile(inputFile));