Skip to content

Commit

Permalink
Button cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Srishti Sharma authored and Srishti Sharma committed Jul 3, 2019
1 parent 1e7744d commit e79c91c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
29 changes: 14 additions & 15 deletions src/basic/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ class Button extends Component {
getInitialStyle() {
return {
borderedBtn: {
borderWidth: this.props.bordered ? 1 : undefined,
borderWidth: this.props.bordered
? variable.defaultBorderWidth
: undefined,
borderRadius:
this.props.rounded && this.props.bordered
? variable.borderRadiusLarge
: 2
: variable.defaultBorderRadius
}
};
}
Expand Down Expand Up @@ -77,7 +79,9 @@ class Button extends Component {
{...this.prepareRootProps()}
ref={c => (this._root = c)}
activeOpacity={
this.props.activeOpacity > 0 ? this.props.activeOpacity : 0.5
this.props.activeOpacity > 0
? this.props.activeOpacity
: variable.defaultActiveOpacity
}
>
{children}
Expand All @@ -87,7 +91,9 @@ class Button extends Component {
if (this.props.rounded) {
let buttonStyle = { ...this.prepareRootProps().style };
let buttonFlex =
this.props.full || this.props.block ? 1 : buttonStyle.flex;
this.props.full || this.props.block
? variable.defaultButtonFlex
: buttonStyle.flex;
return (
<View
style={[
Expand All @@ -98,17 +104,10 @@ class Button extends Component {
>
<TouchableNativeFeedback
ref={c => (this._root = c)}
background={
this.props.androidRippleColor
? TouchableNativeFeedback.Ripple(
this.props.androidRippleColor,
true
)
: TouchableNativeFeedback.Ripple(
variables.androidRippleColor,
true
)
}
background={TouchableNativeFeedback.Ripple(
this.props.androidRippleColor || variables.androidRippleColor,
true
)}
{...this.prepareRootProps()}
>
<View
Expand Down
4 changes: 4 additions & 0 deletions src/theme/variables/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export default {
btnFontFamily: platform === "ios" ? "System" : "Roboto_medium",
btnDisabledBg: "#b5b5b5",
buttonPadding: 6,
defaultActiveOpacity: 0.5,
defaultButtonFlex: 1,
defaultBorderRadius: 2,
defaultBorderWidth: 1,
get btnPrimaryBg() {
return this.brandPrimary;
},
Expand Down

0 comments on commit e79c91c

Please sign in to comment.