Browse Source

Update docs

Guy Carmeli 6 years ago
parent
commit
c9d776e2af
3 changed files with 120 additions and 44 deletions
  1. 1
    0
      docs/_sidebar.md
  2. 60
    44
      docs/docs/styling.md
  3. 59
    0
      docs/docs/topBar-buttons.md

+ 1
- 0
docs/_sidebar.md View File

9
   - [Events](/docs/events)
9
   - [Events](/docs/events)
10
   - [Layout Types](/docs/layout-types)
10
   - [Layout Types](/docs/layout-types)
11
   - [Styling](/docs/styling)
11
   - [Styling](/docs/styling)
12
+  - [TopBar Buttons](/docs/topBar-buttons) 
12
 - Migration from v1
13
 - Migration from v1
13
   - [Top Level](/docs/top-level-api-migration)
14
   - [Top Level](/docs/top-level-api-migration)
14
 - [API](/api/README)
15
 - [API](/api/README)

+ 60
- 44
docs/docs/styling.md View File

54
 
54
 
55
 ## Options object format
55
 ## Options object format
56
 
56
 
57
+### Common options
58
+
57
 ```js
59
 ```js
58
 {
60
 {
59
   statusBar: {
61
   statusBar: {
60
-    backgroundColor: 'red', // Android only
61
     visible: false,
62
     visible: false,
62
-    style: 'light',
63
-    hideWithTopBar: false, // iOS only
64
-    blur: true // iOS only
63
+    style: 'light' | 'dark'
64
+  },
65
+  layout: {
66
+    backgroundColor: 'white',
67
+    orientation: ['portrait', 'landscape'] // An array of supported orientations
65
   },
68
   },
66
-  screenBackgroundColor: 'white',
67
-  orientation: ['portrait', 'landscape'],
68
-  popGesture: true,
69
-  backgroundImage: require('background.png'),
70
-  rootBackgroundImage: require('rootBackground.png'),
71
   modalPresentationStyle: 'overCurrentContext', // Supported styles are: 'formSheet', 'pageSheet', 'overFullScreen', 'overCurrentContext', 'currentContext', 'popOver', 'fullScreen' and 'none'. On Android, only overCurrentContext and none are supported.
69
   modalPresentationStyle: 'overCurrentContext', // Supported styles are: 'formSheet', 'pageSheet', 'overFullScreen', 'overCurrentContext', 'currentContext', 'popOver', 'fullScreen' and 'none'. On Android, only overCurrentContext and none are supported.
72
   topBar: {
70
   topBar: {
73
     visible: true,
71
     visible: true,
74
-    height: 70, // Android only, Height of the TopBar in dp.
75
-    borderColor: 'red', // Android only.
76
-    borderHeight: 1.3, // Android only.
77
-    leftButtons: [{
78
-      id: 'buttonOne',
79
-      icon: require('icon.png'),
80
-      component: {
81
-        name: 'example.CustomButtonComponent'
82
-      },
83
-      title: 'Button one',
84
-      enabled: true,
85
-      disableIconTint: false,
86
-      tintColor: 'red',
87
-      disabledColor: 'black',
88
-      testID: 'buttonOneTestID'
89
-    }],
90
-    rightButtons: [],
72
+    animate: false, // Controls wether TopBar visibility changes should be animated
91
     hideOnScroll: true,
73
     hideOnScroll: true,
92
     buttonColor: 'black',
74
     buttonColor: 'black',
93
-    translucent: true,
94
-    transparent: false,
95
     drawBehind: false,
75
     drawBehind: false,
96
-    noBorder: false,
97
-    blur: false,
98
-    animate: false,
99
-    largeTitle: false,
100
     testID: 'topBar',
76
     testID: 'topBar',
101
-    backButtonImage: require('icon.png'),
102
-    backButtonHidden: false,
103
-    backButtonTitle: 'Back',
104
-    hideBackButtonTitle: false,
105
     component: {
77
     component: {
106
       name: 'example.CustomTopBar'
78
       name: 'example.CustomTopBar'
107
     },
79
     },
110
       fontSize: 14,
82
       fontSize: 14,
111
       color: 'red',
83
       color: 'red',
112
       fontFamily: 'Helvetica',
84
       fontFamily: 'Helvetica',
113
-      height: 70, // Android only, optional; Height of the TitleBar in dp.
114
       component: {
85
       component: {
115
         name: 'example.CustomTopBarTitle',
86
         name: 'example.CustomTopBarTitle',
116
         alignment: 'center'
87
         alignment: 'center'
132
   },
103
   },
133
   bottomTabs: {
104
   bottomTabs: {
134
     visible: true,
105
     visible: true,
135
-    animate: false,
106
+    animate: false, // Controls wether BottomTabs visibility changes should be animated
136
     currentTabIndex: 0,
107
     currentTabIndex: 0,
108
+    currentTabId: 'currentTabId',
137
     testID: 'bottomTabsTestID',
109
     testID: 'bottomTabsTestID',
138
     drawBehind: false,
110
     drawBehind: false,
139
-    currentTabId: 'currentTabId',
140
-    translucent: true,
141
-    hideShadow: false,
142
     backgroundColor: 'white',
111
     backgroundColor: 'white',
143
     tabColor: 'red',
112
     tabColor: 'red',
144
     selectedTabColor: 'blue',
113
     selectedTabColor: 'blue',
149
     title: 'Tab 1',
118
     title: 'Tab 1',
150
     badge: '2',
119
     badge: '2',
151
     testID: 'bottomTabTestID',
120
     testID: 'bottomTabTestID',
152
-    visible: undefined,
153
-    icon: require('tab.png'),
154
-    iconInsets: { top: 0, left: 0, bottom: 0, right: 0 }
121
+    icon: require('tab.png')
155
   },
122
   },
156
   sideMenu: {
123
   sideMenu: {
157
     left: {
124
     left: {
165
   },
132
   },
166
   overlay: {
133
   overlay: {
167
     interceptTouchOutside: true
134
     interceptTouchOutside: true
135
+  }  
136
+}
137
+```
138
+
139
+### iOS specific options
140
+```js
141
+{
142
+  statusBar: {
143
+    hideWithTopBar: false,
144
+    blur: true
145
+  },
146
+  popGesture: true,
147
+  backgroundImage: require('background.png'),
148
+  rootBackgroundImage: require('rootBackground.png'),
149
+  topBar: {
150
+    translucent: true,
151
+    transparent: false,
152
+    noBorder: false,
153
+    blur: false,
154
+    largeTitle: false,
155
+    backButtonImage: require('icon.png'),
156
+    backButtonHidden: false,
157
+    backButtonTitle: 'Back',
158
+    hideBackButtonTitle: false,
159
+  },
160
+  bottomTabs: {
161
+    translucent: true,
162
+    hideShadow: false
163
+  },
164
+  bottomTab: {
165
+    iconInsets: { top: 0, left: 0, bottom: 0, right: 0 }
166
+  }
167
+}
168
+```
169
+
170
+### Android specific options
171
+
172
+```js
173
+{
174
+  statusBar: {
175
+    backgroundColor: 'red'
176
+  },
177
+  topBar: {
178
+    height: 70, // TopBar height in dp.
179
+    borderColor: 'red',
180
+    borderHeight: 1.3,
181
+    title: {
182
+      height: 70 // TitleBar height in dp.
183
+    }
168
   }
184
   }
169
 }
185
 }
170
 ```
186
 ```

+ 59
- 0
docs/docs/topBar-buttons.md View File

1
+# Button options
2
+
3
+The following options can be used to customise buttons.
4
+
5
+```js
6
+{
7
+  id: 'buttonOne',
8
+  icon: require('icon.png'),
9
+  component: {
10
+    name: 'example.CustomButtonComponent'
11
+  },
12
+  title: 'Button one',
13
+  enabled: true,
14
+  disableIconTint: false,
15
+  tintColor: 'red',
16
+  disabledColor: 'black',
17
+  testID: 'buttonOneTestID'
18
+}
19
+```
20
+
21
+# Declaring Buttons statically
22
+
23
+Buttons can be defined in a screen's static options:
24
+
25
+```js
26
+class MyScreen extends Component {
27
+  static get options() {
28
+    topBar: {
29
+    leftButtons: [
30
+      {
31
+        id: 'buttonOne',
32
+        icon: require('icon.png')
33
+      }
34
+    ],
35
+    rightButtons: [],
36
+  }
37
+  
38
+}
39
+```
40
+
41
+# Declaring buttons dynamically
42
+
43
+TopBar buttons can be declared dynamically as well when adding a screen to the layout hierarchy.
44
+
45
+```js
46
+Navigation.push(this.props.componentId, {
47
+  component: {
48
+    name: 'navigation.playground.PushedScreen',
49
+    options: {
50
+      rightButtons: [
51
+        {
52
+          id: 'buttonOne',
53
+          icon: require('icon.png')
54
+        }
55
+      ]
56
+    }
57
+  }
58
+}
59
+```