Guy Carmeli vor 6 Jahren
Ursprung
Commit
c9d776e2af
3 geänderte Dateien mit 120 neuen und 44 gelöschten Zeilen
  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 Datei anzeigen

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

+ 60
- 44
docs/docs/styling.md Datei anzeigen

@@ -54,54 +54,26 @@ Navigation.mergeOptions(this.props.componentId, {
54 54
 
55 55
 ## Options object format
56 56
 
57
+### Common options
58
+
57 59
 ```js
58 60
 {
59 61
   statusBar: {
60
-    backgroundColor: 'red', // Android only
61 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 69
   modalPresentationStyle: 'overCurrentContext', // Supported styles are: 'formSheet', 'pageSheet', 'overFullScreen', 'overCurrentContext', 'currentContext', 'popOver', 'fullScreen' and 'none'. On Android, only overCurrentContext and none are supported.
72 70
   topBar: {
73 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 73
     hideOnScroll: true,
92 74
     buttonColor: 'black',
93
-    translucent: true,
94
-    transparent: false,
95 75
     drawBehind: false,
96
-    noBorder: false,
97
-    blur: false,
98
-    animate: false,
99
-    largeTitle: false,
100 76
     testID: 'topBar',
101
-    backButtonImage: require('icon.png'),
102
-    backButtonHidden: false,
103
-    backButtonTitle: 'Back',
104
-    hideBackButtonTitle: false,
105 77
     component: {
106 78
       name: 'example.CustomTopBar'
107 79
     },
@@ -110,7 +82,6 @@ Navigation.mergeOptions(this.props.componentId, {
110 82
       fontSize: 14,
111 83
       color: 'red',
112 84
       fontFamily: 'Helvetica',
113
-      height: 70, // Android only, optional; Height of the TitleBar in dp.
114 85
       component: {
115 86
         name: 'example.CustomTopBarTitle',
116 87
         alignment: 'center'
@@ -132,13 +103,11 @@ Navigation.mergeOptions(this.props.componentId, {
132 103
   },
133 104
   bottomTabs: {
134 105
     visible: true,
135
-    animate: false,
106
+    animate: false, // Controls wether BottomTabs visibility changes should be animated
136 107
     currentTabIndex: 0,
108
+    currentTabId: 'currentTabId',
137 109
     testID: 'bottomTabsTestID',
138 110
     drawBehind: false,
139
-    currentTabId: 'currentTabId',
140
-    translucent: true,
141
-    hideShadow: false,
142 111
     backgroundColor: 'white',
143 112
     tabColor: 'red',
144 113
     selectedTabColor: 'blue',
@@ -149,9 +118,7 @@ Navigation.mergeOptions(this.props.componentId, {
149 118
     title: 'Tab 1',
150 119
     badge: '2',
151 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 123
   sideMenu: {
157 124
     left: {
@@ -165,6 +132,55 @@ Navigation.mergeOptions(this.props.componentId, {
165 132
   },
166 133
   overlay: {
167 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 Datei anzeigen

@@ -0,0 +1,59 @@
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
+```