Skip to content

Commit b437dd2

Browse files
PC Futuresmastermoo
authored andcommitted
Switch MainButton to use Margin not Padding, and fix shadow prop warning (#212)
* Switch MainButton to use Margin not Padding Switch from `paddingHorizontal` to `marginHorizontal` * Move Shadow Props to different View Currently the shadow is rendered on an item without a background color, which causes a warning. This commit moves the shadow props to the same View that contains the backgroundColor, thus removing the warning. Makes no difference to usage/appearance.
1 parent 3d9be2c commit b437dd2

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

ActionButton.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export default class ActionButton extends Component {
185185
borderRadius: this.props.size / 2,
186186
width: this.props.size
187187
}
188-
: { paddingHorizontal: this.props.offsetX, zIndex: this.props.zIndex };
188+
: { marginHorizontal: this.props.offsetX, zIndex: this.props.zIndex };
189189

190190
return (
191191
<View style={[

ActionButtonItem.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,11 @@ export default class ActionButtonItem extends Component {
107107
style={[animatedViewStyle, parentStyle]}
108108
>
109109
<View
110-
style={[
111-
{
112-
width: this.props.size,
113-
height: this.props.size,
114-
borderRadius: size / 2
115-
},
116-
!hideShadow && shadowStyle,
117-
!hideShadow && this.props.shadowStyle
118-
]}
110+
style={{
111+
width: this.props.size,
112+
height: this.props.size,
113+
borderRadius: size / 2
114+
}}
119115
>
120116
<Touchable
121117
background={touchableBackground(
@@ -125,7 +121,10 @@ export default class ActionButtonItem extends Component {
125121
activeOpacity={this.props.activeOpacity || DEFAULT_ACTIVE_OPACITY}
126122
onPress={this.props.onPress}
127123
>
128-
<View style={[buttonStyle]}>
124+
<View style={[
125+
buttonStyle,
126+
!hideShadow ? {...shadowStyle, ...this.props.shadowStyle} : null
127+
]}>
129128
{this.props.children}
130129
</View>
131130
</Touchable>

0 commit comments

Comments
 (0)