Skip to content

Commit

Permalink
Merge pull request #19 from danielweinmann/disabled_style
Browse files Browse the repository at this point in the history
Adds optional disabledStyle prop
  • Loading branch information
alvaromb committed Feb 9, 2016
2 parents bb4a2aa + f2408d6 commit 0194485
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var Button = React.createClass({
propTypes: Object.assign({},
{
textStyle: Text.propTypes.style,
disabledStyle: Text.propTypes.style,
children: PropTypes.string.isRequired,
isLoading: PropTypes.bool,
isDisabled: PropTypes.bool,
Expand Down Expand Up @@ -80,7 +81,7 @@ var Button = React.createClass({
render: function () {
if (this.props.isDisabled === true || this.props.isLoading === true) {
return (
<View style={[styles.button, this.props.style, styles.opacity]}>
<View style={[styles.button, this.props.style, (this.props.disabledStyle || styles.opacity)]}>
{this._renderInnerText()}
</View>
);
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ and disable it to prevent accidental taps.
| ``onPressOut`` | ``func`` | Function to execute when the ``onPressOut`` event is triggered. |
| ``onLongPress`` | ``func`` | Function to execute when the ``onLongPress`` event is triggered. |
| ``textStyle`` | ``TextStylePropTypes`` | The StyleSheet to apply to the inner button text. |
| ``disabledStyle`` | ``TextStylePropTypes`` | The StyleSheet to apply when disabled. |
| ``children`` | ``string`` | The ``string`` to render as the text button. |
| ``isLoading`` | ``bool`` | Renders an inactive state dimmed button with a spinner if ``true``. |
| ``isDisabled`` | ``bool`` | Renders an inactive state dimmed button if ``true``. |
Expand Down

0 comments on commit 0194485

Please sign in to comment.