diff --git a/readme.md b/readme.md index 9540dfe..7a587dd 100644 --- a/readme.md +++ b/readme.md @@ -70,21 +70,25 @@ Other [Ripple][ripple] properties will also work ## TextButton properties - name | description | type | default -:------------------ |:------------------------------------- | --------:|:------------------ - title | Button title | String | - - titleColor | Button title color | String | rgb(0, 0, 0) - disabledTitleColor | Button title color for disabled state | String | rgba(0, 0, 0, .26) - titleStyle | Button title style | Object | - + name | description | type | default +:------------------ |:-------------------------------------- | ---------:|:------------------ + title | Button title | String | - + titleColor | Button title color | String | rgb(0, 0, 0) + disabledTitleColor | Button title color for disabled state | String | rgba(0, 0, 0, .26) + titleStyle | Button title style | Object | - + icon | Icon component to place next to text | Component | - + iconPlacement | Which side of text Icon will appear on | String | "left" ## RaisedTextButton properties - name | description | type | default -:------------------ |:------------------------------------- | --------:|:------------------ - title | Button title | String | - - titleColor | Button title color | String | rgb(66, 66, 66) - disabledTitleColor | Button title color for disabled state | String | rgba(0, 0, 0, .26) - titleStyle | Button title style | Object | - + name | description | type | default +:------------------ |:-------------------------------------- | ---------:|:------------------ + title | Button title | String | - + titleColor | Button title color | String | rgb(66, 66, 66) + disabledTitleColor | Button title color for disabled state | String | rgba(0, 0, 0, .26) + titleStyle | Button title style | Object | - + icon | Icon component to place next to text | Component | - + iconPlacement | Which side of text Icon will appear on | String | "left" ## Example diff --git a/src/components/button/styles.js b/src/components/button/styles.js index ebb55c3..26628b7 100644 --- a/src/components/button/styles.js +++ b/src/components/button/styles.js @@ -4,6 +4,9 @@ const styles = StyleSheet.create({ container: { borderRadius: 2, justifyContent: 'space-around', + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'center', }, shadeContainer: { diff --git a/src/components/raised-button/styles.js b/src/components/raised-button/styles.js index 91e390e..82f9171 100644 --- a/src/components/raised-button/styles.js +++ b/src/components/raised-button/styles.js @@ -5,6 +5,9 @@ const styles = StyleSheet.create({ height: 36, minWidth: 88, paddingHorizontal: 16, + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'center', ...Platform.select({ android: { diff --git a/src/components/raised-text-button/index.js b/src/components/raised-text-button/index.js index 22ac30c..54cfe24 100644 --- a/src/components/raised-text-button/index.js +++ b/src/components/raised-text-button/index.js @@ -40,6 +40,8 @@ export default class RaisedTextButton extends PureComponent { titleColor, titleStyle, disabledTitleColor, + icon, + iconPlacement, ...props } = this.props; @@ -57,12 +59,14 @@ export default class RaisedTextButton extends PureComponent { {...props} disableAnimation={disableAnimation} > + {icon && iconPlacement !== 'right' && icon} {title} + {icon && iconPlacement === 'right' && icon} ); } diff --git a/src/components/text-button/index.js b/src/components/text-button/index.js index e8c13b6..51b0e6a 100644 --- a/src/components/text-button/index.js +++ b/src/components/text-button/index.js @@ -45,6 +45,8 @@ export default class TextButton extends PureComponent { titleColor, titleStyle, disabledTitleColor, + icon, + iconPlacement, style, ...props } = this.props; @@ -64,12 +66,14 @@ export default class TextButton extends PureComponent { {...props} disableAnimation={disableAnimation} > + {icon && iconPlacement !== 'right' && icon} {title} + {icon && iconPlacement === 'right' && icon} ); }