Skip to content

Commit

Permalink
Add showAsAction prop (#5034)
Browse files Browse the repository at this point in the history
  • Loading branch information
retyui authored and guyca committed Apr 28, 2019
1 parent 2d5844e commit cb763b4
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions docs/docs/topBar-buttons.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ The following options can be used to customise buttons.
name: 'example.CustomButtonComponent'
},
text: 'Button one',
systemItem: 'done', // iOS only. Sets a system bar button item as the icon. Matches UIBarButtonSystemItem naming. See below for details.
enabled: true,
disableIconTint: false,
color: 'red',
disabledColor: 'black',
testID: 'buttonOneTestID'
testID: 'buttonOneTestID',
// Android only
showAsAction: 'ifRoom', // See below for details.
// iOS only
systemItem: 'done', // Sets a system bar button item as the icon. Matches UIBarButtonSystemItem naming. See below for details.
}
```

Expand Down Expand Up @@ -48,6 +51,19 @@ On iOS, UIKit supplies some common bar button glyphs for developers to use. The

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/).


## Android showAsAction

It is keyword witch configure when and how this item should appear as an action item in the app bar.
A menu item can appear as an action item only when the activity includes an app bar.

* `always`
* `ifRoom`
* `never`
* `withText`

[More info about `showAsAction` values](https://developer.android.com/guide/topics/resources/menu-resource)

# Declaring Buttons statically

Buttons can be defined in a screen's options:
Expand Down Expand Up @@ -129,6 +145,7 @@ class MyScreen extends Component {
As buttons are part of a screen's options, they can be modified like any other styling option using the `mergeOptions` command.
## Setting buttons
The following command will set the screen's right buttons. If the screen already has Right Buttons declared - they will be overridden.
```js
Expand All @@ -145,6 +162,7 @@ Navigation.mergeOptions(this.props.componentId, {
```
## Removing buttons
Buttons can be removed by setting zero buttons, as shown in the snippet below.
```js
Expand Down

0 comments on commit cb763b4

Please sign in to comment.