Skip to content

Commit

Permalink
Merge pull request react-native-elements#35 from tolu360/master
Browse files Browse the repository at this point in the history
Support for disabled buttons
  • Loading branch information
dabit3 committed Sep 25, 2016
2 parents c7ee0e8 + dfaed34 commit 50af533
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions Readme.MD
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ import { Button } from 'react-native-elements'
| fontSize | 18 | number | font size (optional) |
| underlayColor | transparent | string(color) | underlay color for button press (optional) |
| raised | false | boolean | flag to add raised button styling (optional) |
| disabled | false | boolean | prop to indicate button is disabled (optional) |


## Social Icons & Buttons
Expand Down
9 changes: 6 additions & 3 deletions src/buttons/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const Button = ({
textStyle,
small,
iconRight,
disabled,
fontWeight,
fontFamily}) => {
let iconElement
Expand All @@ -55,7 +56,8 @@ const Button = ({
return (
<TouchableHighlight
underlayColor={underlayColor || 'transparent'}
onPress={onPress || log}>
onPress={onPress || log}
disabled={disabled || false}>
<View
style={[
styles.button,
Expand All @@ -64,7 +66,7 @@ const Button = ({
secondary3 && {backgroundColor: colors.secondary3},
primary1 && {backgroundColor: colors.primary1},
primary2 && {backgroundColor: colors.primary2},
backgroundColor && {backgroundColor},
backgroundColor && {backgroundColor: disabled ? colors.disabled : backgroundColor},
borderRadius && {borderRadius},
buttonStyle && buttonStyle,
raised && styles.raised,
Expand Down Expand Up @@ -110,7 +112,8 @@ Button.propTypes = {
fontSize: PropTypes.number,
underlayColor: PropTypes.string,
raised: PropTypes.bool,
textStyle: PropTypes.any
textStyle: PropTypes.any,
disabled: PropTypes.bool
}

styles = StyleSheet.create({
Expand Down
3 changes: 2 additions & 1 deletion src/config/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ export default {
grey5: '#e1e8ee',
dkGreyBg: '#232323',
greyOutline: '#cbd2d9',
searchBg: '#303337'
searchBg: '#303337',
disabled: '#dadee0',
}

0 comments on commit 50af533

Please sign in to comment.