Skip to content

Commit 0194485

Browse files
committed
Merge pull request #19 from danielweinmann/disabled_style
Adds optional disabledStyle prop
2 parents bb4a2aa + f2408d6 commit 0194485

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Button.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var Button = React.createClass({
1717
propTypes: Object.assign({},
1818
{
1919
textStyle: Text.propTypes.style,
20+
disabledStyle: Text.propTypes.style,
2021
children: PropTypes.string.isRequired,
2122
isLoading: PropTypes.bool,
2223
isDisabled: PropTypes.bool,
@@ -80,7 +81,7 @@ var Button = React.createClass({
8081
render: function () {
8182
if (this.props.isDisabled === true || this.props.isLoading === true) {
8283
return (
83-
<View style={[styles.button, this.props.style, styles.opacity]}>
84+
<View style={[styles.button, this.props.style, (this.props.disabledStyle || styles.opacity)]}>
8485
{this._renderInnerText()}
8586
</View>
8687
);

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ and disable it to prevent accidental taps.
4747
| ``onPressOut`` | ``func`` | Function to execute when the ``onPressOut`` event is triggered. |
4848
| ``onLongPress`` | ``func`` | Function to execute when the ``onLongPress`` event is triggered. |
4949
| ``textStyle`` | ``TextStylePropTypes`` | The StyleSheet to apply to the inner button text. |
50+
| ``disabledStyle`` | ``TextStylePropTypes`` | The StyleSheet to apply when disabled. |
5051
| ``children`` | ``string`` | The ``string`` to render as the text button. |
5152
| ``isLoading`` | ``bool`` | Renders an inactive state dimmed button with a spinner if ``true``. |
5253
| ``isDisabled`` | ``bool`` | Renders an inactive state dimmed button if ``true``. |

0 commit comments

Comments
 (0)