Browse Source

Updated TopBar buttons doc page

Guy Carmeli 6 years ago
parent
commit
7653a17335
1 changed files with 31 additions and 0 deletions
  1. 31
    0
      docs/docs/topBar-buttons.md

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

@@ -57,3 +57,34 @@ Navigation.push(this.props.componentId, {
57 57
   }
58 58
 }
59 59
 ```
60
+
61
+# Modifying buttons at runtime
62
+
63
+As buttons are part of a screen's options, they can be modified like any other styling option using the `mergeOptions` command.
64
+
65
+## Setting buttons
66
+The following command will set the screen's right buttons. If the screen already has Right Buttons declared - they will be overridden.
67
+
68
+```js
69
+Navigation.mergeOptions(this.props.componentId, {
70
+  topBar: {
71
+    rightButtons: [
72
+      {
73
+        id: 'myDynamicButton',
74
+        title: 'My Button'
75
+      }
76
+    ]
77
+  }
78
+});
79
+```
80
+
81
+## Removing buttons
82
+Buttons can be removed by setting zero buttons as shown in the snippet below.
83
+
84
+```js
85
+Navigation.mergeOptions(this.props.componentId, {
86
+  topBar: {
87
+    rightButtons: []
88
+  }
89
+});
90
+```