|
@@ -136,7 +136,15 @@ Navigation.startTabBasedApp({
|
136
|
136
|
selectedIcon: require('../img/two_selected.png'),
|
137
|
137
|
title: 'Screen Two'
|
138
|
138
|
}
|
139
|
|
- ]
|
|
139
|
+ ],
|
|
140
|
+ drawer: { // optional, add this if you want a side menu drawer in your app
|
|
141
|
+ left: { // optional, define if you want a drawer from the left
|
|
142
|
+ screen: 'example.FirstSideMenu' // unique ID registered with Navigation.registerScreen
|
|
143
|
+ },
|
|
144
|
+ right: { // optional, define if you want a drawer from the right
|
|
145
|
+ screen: 'example.SecondSideMenu' // unique ID registered with Navigation.registerScreen
|
|
146
|
+ }
|
|
147
|
+ }
|
140
|
148
|
});
|
141
|
149
|
```
|
142
|
150
|
|
|
@@ -150,6 +158,14 @@ Navigation.startSingleScreenApp({
|
150
|
158
|
screen: 'example.WelcomeScreen', // unique ID registered with Navigation.registerScreen
|
151
|
159
|
title: 'Welcome', // title of the screen as appears in the nav bar (optional)
|
152
|
160
|
navigatorStyle: {} // override the navigator style for the screen, see "Styling the navigator" below (optional)
|
|
161
|
+ },
|
|
162
|
+ drawer: { // optional, add this if you want a side menu drawer in your app
|
|
163
|
+ left: { // optional, define if you want a drawer from the left
|
|
164
|
+ screen: 'example.FirstSideMenu' // unique ID registered with Navigation.registerScreen
|
|
165
|
+ },
|
|
166
|
+ right: { // optional, define if you want a drawer from the right
|
|
167
|
+ screen: 'example.SecondSideMenu' // unique ID registered with Navigation.registerScreen
|
|
168
|
+ }
|
153
|
169
|
}
|
154
|
170
|
});
|
155
|
171
|
```
|
|
@@ -205,6 +221,16 @@ Pop the top screen from this screen's navigation stack.
|
205
|
221
|
this.navigator.pop({
|
206
|
222
|
animated: true // does the pop have transition animation or does it happen immediately (optional)
|
207
|
223
|
});
|
|
224
|
+```
|
|
225
|
+
|
|
226
|
+ * **popToRoot(params = {})**
|
|
227
|
+
|
|
228
|
+Pop all the screens until the root from this screen's navigation stack.
|
|
229
|
+
|
|
230
|
+```js
|
|
231
|
+this.navigator.popToRoot({
|
|
232
|
+ animated: true // does the pop have transition animation or does it happen immediately (optional)
|
|
233
|
+});
|
208
|
234
|
```
|
209
|
235
|
|
210
|
236
|
* **showModal(params = {})**
|
|
@@ -229,6 +255,39 @@ Dismiss the current modal.
|
229
|
255
|
this.navigator.dismissModal({
|
230
|
256
|
animationType: 'slide-down' // 'none' / 'slide-down' , dismiss animation for the modal (optional, default 'slide-down')
|
231
|
257
|
});
|
|
258
|
+```
|
|
259
|
+
|
|
260
|
+ * **setButtons(params = {})**
|
|
261
|
+
|
|
262
|
+Set buttons dynamically on the navigator. If your buttons don't change during runtime, see "Adding buttons to the navigator" below to add them using `static navigatorButtons = {...};`.
|
|
263
|
+
|
|
264
|
+```js
|
|
265
|
+this.navigator.setButtons({
|
|
266
|
+ leftButtons: [], // see "Adding buttons to the navigator" below for format (optional)
|
|
267
|
+ rightButtons: [], // see "Adding buttons to the navigator" below for format (optional)
|
|
268
|
+ animated: true // does the change have transition animation or does it happen immediately (optional)
|
|
269
|
+});
|
|
270
|
+```
|
|
271
|
+
|
|
272
|
+ * **setTitle(params = {})**
|
|
273
|
+
|
|
274
|
+Set the nav bar title dynamically. If your title doesn't change during runtime, set it when the screen is defined / pushed.
|
|
275
|
+
|
|
276
|
+```js
|
|
277
|
+this.navigator.setTitle({
|
|
278
|
+ title: "Dynamic Title" // the new title of the screen as appears in the nav bar
|
|
279
|
+});
|
|
280
|
+```
|
|
281
|
+
|
|
282
|
+ * **toggleDrawer(params = {})**
|
|
283
|
+
|
|
284
|
+Toggle the side menu drawer assuming you have one in your app.
|
|
285
|
+
|
|
286
|
+```js
|
|
287
|
+this.navigator.toggleDrawer({
|
|
288
|
+ side: 'left', // the side of the drawer since you can have two, 'left' / 'right'
|
|
289
|
+ animated: true // does the toggle have transition animation or does it happen immediately (optional)
|
|
290
|
+});
|
232
|
291
|
```
|
233
|
292
|
|
234
|
293
|
## Styling the navigator
|
|
@@ -302,7 +361,8 @@ class FirstTabScreen extends Screen {
|
302
|
361
|
rightButtons: [
|
303
|
362
|
{
|
304
|
363
|
title: 'Edit', // for a textual button, provide the button title (label)
|
305
|
|
- id: 'edit' // id for this button, given in onNavigatorEvent(event) to help understand which button was clicked
|
|
364
|
+ id: 'edit', // id for this button, given in onNavigatorEvent(event) to help understand which button was clicked
|
|
365
|
+ testID: 'e2e_rules' // optional, used to locate this view in end-to-end tests
|
306
|
366
|
},
|
307
|
367
|
{
|
308
|
368
|
icon: require('../../img/navicon_add.png'), // for icon button, provide the local image asset name
|