Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Centering and shadows on android fixed with prop fixNativeFeedbackRadius #228

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion ActionButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export default class ActionButton extends Component {
const parentStyle = isAndroid &&
this.props.fixNativeFeedbackRadius
? {
right: this.props.offsetX,
marginHorizontal: this.props.offsetX,
zIndex: this.props.zIndex,
borderRadius: this.props.size / 2,
width: this.props.size
Expand Down
32 changes: 15 additions & 17 deletions ActionButtonItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,28 +85,27 @@ export default class ActionButtonItem extends Component {
};

if (position !== "center")
buttonStyle[position] = (this.props.parentSize - size) / 2;
animatedViewStyle[position] = (this.props.parentSize - size) / 2;

const Touchable = getTouchableComponent(this.props.useNativeFeedback);

const parentStyle = isAndroid &&
this.props.fixNativeFeedbackRadius
? {
height: size,
marginBottom: spacing,
right: this.props.offsetX,
borderRadius: this.props.size / 2
const parentStyle = {
marginHorizontal: this.props.offsetX,
marginBottom: spacing + SHADOW_SPACE,
borderRadius: this.props.size / 2,
}
: {
paddingHorizontal: this.props.offsetX,
height: size + SHADOW_SPACE + spacing
};

return (
<Animated.View
pointerEvents="box-none"
style={[animatedViewStyle, parentStyle]}
style={[animatedViewStyle]}
>
<View>
<View
style={[
parentStyle,
!hideShadow && isAndroid ? {...shadowStyle, ...this.props.shadowStyle} : null
]}
>
<Touchable
testID={this.props.testID}
background={touchableBackground(
Expand All @@ -118,7 +117,7 @@ export default class ActionButtonItem extends Component {
>
<View style={[
buttonStyle,
!hideShadow ? {...shadowStyle, ...this.props.shadowStyle} : null
!hideShadow && !isAndroid ? {...shadowStyle, ...this.props.shadowStyle} : null
]}>
{this.props.children}
</View>
Expand Down Expand Up @@ -177,8 +176,7 @@ export default class ActionButtonItem extends Component {
return (
<TextTouchable
background={touchableBackground(
this.props.nativeFeedbackRippleColor,
this.props.fixNativeFeedbackRadius
this.props.nativeFeedbackRippleColor
)}
activeOpacity={this.props.activeOpacity || DEFAULT_ACTIVE_OPACITY}
onPress={this.props.onPress}
Expand Down