Browse Source

Update README.md

Tal Kol 9 years ago
parent
commit
cfa76ea749
1 changed files with 62 additions and 2 deletions
  1. 62
    2
      README.md

+ 62
- 2
README.md View File

136
       selectedIcon: require('../img/two_selected.png'),
136
       selectedIcon: require('../img/two_selected.png'),
137
       title: 'Screen Two'
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
     screen: 'example.WelcomeScreen', // unique ID registered with Navigation.registerScreen
158
     screen: 'example.WelcomeScreen', // unique ID registered with Navigation.registerScreen
151
     title: 'Welcome', // title of the screen as appears in the nav bar (optional)
159
     title: 'Welcome', // title of the screen as appears in the nav bar (optional)
152
     navigatorStyle: {} // override the navigator style for the screen, see "Styling the navigator" below (optional)
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
 this.navigator.pop({
221
 this.navigator.pop({
206
   animated: true // does the pop have transition animation or does it happen immediately (optional)
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
  * **showModal(params = {})**
236
  * **showModal(params = {})**
229
 this.navigator.dismissModal({
255
 this.navigator.dismissModal({
230
   animationType: 'slide-down' // 'none' / 'slide-down' , dismiss animation for the modal (optional, default 'slide-down')
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
 ## Styling the navigator
293
 ## Styling the navigator
302
     rightButtons: [
361
     rightButtons: [
303
       {
362
       {
304
         title: 'Edit', // for a textual button, provide the button title (label)
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
         icon: require('../../img/navicon_add.png'), // for icon button, provide the local image asset name
368
         icon: require('../../img/navicon_add.png'), // for icon button, provide the local image asset name