Browse Source

Add basic documentation structure (#2386)

Guy Carmeli 7 years ago
parent
commit
1163868843
No account linked to committer's email address

+ 12
- 0
docs/docs/BottomTabs.md View File

@@ -0,0 +1,12 @@
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 View File

@@ -0,0 +1,19 @@
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 View File

@@ -0,0 +1,13 @@
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 View File

@@ -5,7 +5,16 @@
5 5
 * [Navigation](#Navigation)
6 6
     * [.registerContainer(containerName, getContainerFunc)](#Navigation+registerContainer)
7 7
     * [.setRoot(root)](#Navigation+setRoot)
8
+    * [.setDefaultOptions(options)](#Navigation+setDefaultOptions)
8 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,6 +44,19 @@ Reset the navigation stack to a new screen (the stack root is changed).
35 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 62
 <a name="Navigation+setOptions"></a>
@@ -45,9 +67,105 @@ Change a containers navigation options
45 67
 
46 68
 | Param | Type | Description |
47 69
 | --- | --- | --- |
48
-| containerId | <code>string</code> | Unique container name |
70
+| containerId | <code>string</code> | The container's id. |
49 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 View File

@@ -0,0 +1,24 @@
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 View File

@@ -0,0 +1,14 @@
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 View File

@@ -0,0 +1,13 @@
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 View File

@@ -0,0 +1,16 @@
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 View File

@@ -0,0 +1,20 @@
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 View File

@@ -46,47 +46,83 @@ class Navigation {
46 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 53
   setDefaultOptions(options) {
50 54
     this.commands.setDefaultOptions(options);
51 55
   }
52 56
 
53 57
   /**
54 58
    * Change a containers navigation options
55
-   * @param {string} containerId Unique container name
59
+   * @param {string} containerId The container's id.
56 60
    * @param {NavigationOptions} options
57 61
    */
58 62
   setOptions(containerId, options) {
59 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 70
   showModal(params) {
63 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 78
   dismissModal(containerId) {
67 79
     return this.commands.dismissModal(containerId);
68 80
   }
69 81
 
82
+  /**
83
+   * Dismiss all Modals
84
+   */
70 85
   dismissAllModals() {
71 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 103
   pop(containerId, params) {
79 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 111
   popTo(containerId) {
83 112
     return this.commands.popTo(containerId);
84 113
   }
85 114
 
115
+  /**
116
+   * Pop the container's stack to root.
117
+   * @param {*} containerId 
118
+   */
86 119
   popToRoot(containerId) {
87 120
     return this.commands.popToRoot(containerId);
88 121
   }
89 122
 
123
+  /**
124
+   * Obtain the events registery instance
125
+   */
90 126
   events() {
91 127
     return this.publicEventsRegistry;
92 128
   }

+ 0
- 2
lib/src/params/BottomTabs.js View File

@@ -3,8 +3,6 @@ const Container = require('./Container');
3 3
 
4 4
 class BottomTabs {
5 5
   /**
6
-   * @constructor
7
-   * @typedef {Object} BottomTabs
8 6
    * @property {Container[]} tabs
9 7
    */
10 8
   constructor(tabs) {

+ 0
- 1
lib/src/params/Container.js View File

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

+ 0
- 1
lib/src/params/Root.js View File

@@ -4,7 +4,6 @@ const BottomTabs = require('./BottomTabs');
4 4
 
5 5
 class Root {
6 6
   /**
7
-   * @typedef {Object} Root
8 7
    * @property {Container} container
9 8
    * @property {SideMenu} [sideMenu]
10 9
    * @property {BottomTabs} [bottomTabs]

+ 0
- 1
lib/src/params/SideMenu.js View File

@@ -2,7 +2,6 @@ const Container = require('./Container');
2 2
 
3 3
 class SideMenu {
4 4
   /**
5
-  * @typedef {Object} SideMenu
6 5
   * @property {Container} [left]
7 6
   * @property {Container} [right]
8 7
   */

+ 0
- 1
lib/src/params/TabBar.js View File

@@ -2,7 +2,6 @@ const { isEmpty } = require('lodash');
2 2
 
3 3
 class TabBar {
4 4
   /**
5
-   * @typedef {Object} TabBar
6 5
    * @property {string} [currentTabId]
7 6
    * @property {number} [currentTabIndex]
8 7
    * @property {number} [tabBadge]

+ 0
- 1
lib/src/params/TopBar.js View File

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

+ 9
- 2
scripts/generate-js-doc.js View File

@@ -2,7 +2,7 @@ const jsdoc2md = require('jsdoc-to-markdown');
2 2
 const fs = require('fs');
3 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 6
 const outputDir = './docs/docs/';
7 7
 const partial = ['./docs/templates/scope.hbs', './docs/templates/docs.hbs'];
8 8
 
@@ -35,4 +35,11 @@ function createDocFileForClass(className, templateData) {
35 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));