Skip to content

Commit

Permalink
updated images, updated buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
dabit3 committed Sep 9, 2016
1 parent c0bc522 commit 343b7d6
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Readme.MD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![React Native Elements](http://i.imgur.com/HU4S78V.png)
## React Native UI Toolkit

![React Native UI Toolkit](http://i.imgur.com/2ehiIx1.png)
![React Native UI Toolkit](http://i.imgur.com/ZyNsBmM.png)

## Get Started

Expand Down
80 changes: 54 additions & 26 deletions src/buttons/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,51 @@ const log = () => {
console.log('please attach method to this component')
}

const Button = ({buttonStyle, title, onPress, icon, secondary, secondary2, secondary3, primary1, primary2, primary3, backgroundColor, color, fontSize, underlayColor, raised, textStyle}) => (
<TouchableHighlight
underlayColor={underlayColor || 'transparent'}
onPress={onPress || log}>
<View
style={[
styles.button,
secondary && {backgroundColor: colors.secondary},
secondary2 && {backgroundColor: colors.secondary2},
secondary3 && {backgroundColor: colors.secondary3},
primary1 && {backgroundColor: colors.primary1},
primary2 && {backgroundColor: colors.primary2},
backgroundColor && {backgroundColor},
buttonStyle && buttonStyle,
raised && styles.raised
]}
>
{
icon && <Icon color={icon.color || 'white'} size={icon.size || 26} style={styles.icon} name={icon.name} />
}
<Text style={[styles.text, textStyle && textStyle, color && {color}, fontSize && {fontSize}]}>
{title}
</Text>
</View>
</TouchableHighlight>
)
const Button = ({buttonStyle, title, onPress, icon, secondary, secondary2, secondary3, primary1, primary2, primary3, backgroundColor, color, fontSize, underlayColor, raised, textStyle, small, iconRight}) => {
let iconElement
if (icon) {
iconElement = (
<Icon color={icon.color || 'white'} size={icon.size || small ? 18 : 26} style={iconRight ? styles.iconRight : styles.icon} name={icon.name} />
)
}
return (
<TouchableHighlight
underlayColor={underlayColor || 'transparent'}
onPress={onPress || log}>
<View
style={[
styles.button,
secondary && {backgroundColor: colors.secondary},
secondary2 && {backgroundColor: colors.secondary2},
secondary3 && {backgroundColor: colors.secondary3},
primary1 && {backgroundColor: colors.primary1},
primary2 && {backgroundColor: colors.primary2},
backgroundColor && {backgroundColor},
buttonStyle && buttonStyle,
raised && styles.raised,
small && styles.small
]}
>
{
icon && !iconRight && iconElement
}
<Text
style={[
styles.text,
textStyle && textStyle,
color && {color},
fontSize && {fontSize},
small && styles.smallFont
]}>
{title}
</Text>
{
icon && iconRight && iconElement
}
</View>
</TouchableHighlight>
)
}

Button.propTypes = {
buttonStyle: PropTypes.any,
Expand Down Expand Up @@ -78,6 +97,15 @@ styles = StyleSheet.create({
icon: {
marginRight: 10
},
iconRight: {
marginLeft: 10
},
small: {
padding: 12
},
smallFont: {
fontSize: 14
},
raised: {
...Platform.select({
ios: {
Expand Down

0 comments on commit 343b7d6

Please sign in to comment.