Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 20 additions & 19 deletions ActionButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export default class ActionButton extends Component {

getActionButtonStyles() {
const actionButtonStyles = [styles.actionBarItem, this.getButtonSize()];
if(!this.props.hideShadow) actionButtonStyles.push(styles.btnShadow);
return actionButtonStyles;
}

Expand Down Expand Up @@ -105,11 +104,6 @@ export default class ActionButton extends Component {
const animatedViewStyle = [
styles.btn,
{
width: this.props.size,
height: this.props.size,
borderRadius: this.props.size / 2,
marginHorizontal: 8,
marginBottom: shadowHeight,
backgroundColor: this.anim.interpolate({
inputRange: [0, 1],
outputRange: [this.props.buttonColor, buttonColorMax]
Expand All @@ -128,22 +122,29 @@ export default class ActionButton extends Component {
},
];

if(!this.props.hideShadow && Platform.OS === 'android') animatedViewStyle.push(styles.btnShadow);
const combinedStyle = {
width: this.props.size,
height: this.props.size,
borderRadius: this.props.size / 2,
marginBottom: shadowHeight,
backgroundColor: this.props.buttonColor
}

const actionButtonStyles = [ this.getActionButtonStyles(), combinedStyle, animatedViewStyle ]

return (
<View style={this.getActionButtonStyles()}>
<TouchableOpacity
activeOpacity={0.85}
onLongPress={this.props.onLongPress}
onPress={() => {
this.props.onPress()
if (this.props.children) this.animateButton()
}}>
<Animated.View
style={animatedViewStyle}>
<View style={ !this.props.hideShadow && [ styles.btnShadow, combinedStyle, { marginHorizontal: 8 }]}>
<Animated.View style={ actionButtonStyles }>
<TouchableOpacity
activeOpacity={0.85}
onLongPress={this.props.onLongPress}
onPress={() => {
this.props.onPress()
if (this.props.children) this.animateButton()
}}>
{this._renderButtonIcon()}
</Animated.View>
</TouchableOpacity>
</TouchableOpacity>
</Animated.View>
</View>
);
}
Expand Down