Browse Source

Add showAsAction prop (#5034)

David undefined 5 years ago
parent
commit
cb763b450f
1 changed files with 20 additions and 2 deletions
  1. 20
    2
      docs/docs/topBar-buttons.md

+ 20
- 2
docs/docs/topBar-buttons.md View File

10
     name: 'example.CustomButtonComponent'
10
     name: 'example.CustomButtonComponent'
11
   },
11
   },
12
   text: 'Button one',
12
   text: 'Button one',
13
-  systemItem: 'done', // iOS only. Sets a system bar button item as the icon. Matches UIBarButtonSystemItem naming. See below for details.
14
   enabled: true,
13
   enabled: true,
15
   disableIconTint: false,
14
   disableIconTint: false,
16
   color: 'red',
15
   color: 'red',
17
   disabledColor: 'black',
16
   disabledColor: 'black',
18
-  testID: 'buttonOneTestID'
17
+  testID: 'buttonOneTestID',
18
+  // Android only
19
+  showAsAction: 'ifRoom', // See below for details.
20
+  // iOS only
21
+  systemItem: 'done', // Sets a system bar button item as the icon. Matches UIBarButtonSystemItem naming. See below for details.
19
 }
22
 }
20
 ```
23
 ```
21
 
24
 
48
 
51
 
49
 More information about these glyphs can be found in [Apple's Human Interface Guidelines](https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/system-icons/).
52
 More information about these glyphs can be found in [Apple's Human Interface Guidelines](https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/system-icons/).
50
 
53
 
54
+
55
+## Android showAsAction
56
+
57
+It is keyword witch configure when and how this item should appear as an action item in the app bar. 
58
+A menu item can appear as an action item only when the activity includes an app bar.
59
+
60
+* `always`
61
+* `ifRoom`
62
+* `never`
63
+* `withText`
64
+
65
+[More info about `showAsAction` values](https://developer.android.com/guide/topics/resources/menu-resource)
66
+
51
 # Declaring Buttons statically
67
 # Declaring Buttons statically
52
 
68
 
53
 Buttons can be defined in a screen's options:
69
 Buttons can be defined in a screen's options:
129
 As buttons are part of a screen's options, they can be modified like any other styling option using the `mergeOptions` command.
145
 As buttons are part of a screen's options, they can be modified like any other styling option using the `mergeOptions` command.
130
 
146
 
131
 ## Setting buttons
147
 ## Setting buttons
148
+
132
 The following command will set the screen's right buttons. If the screen already has Right Buttons declared - they will be overridden.
149
 The following command will set the screen's right buttons. If the screen already has Right Buttons declared - they will be overridden.
133
 
150
 
134
 ```js
151
 ```js
145
 ```
162
 ```
146
 
163
 
147
 ## Removing buttons
164
 ## Removing buttons
165
+
148
 Buttons can be removed by setting zero buttons, as shown in the snippet below.
166
 Buttons can be removed by setting zero buttons, as shown in the snippet below.
149
 
167
 
150
 ```js
168
 ```js