Skip to content

Commit f27528a

Browse files
committed
solved merge conflict
2 parents a37ce1e + cd06f74 commit f27528a

File tree

4 files changed

+82
-26
lines changed

4 files changed

+82
-26
lines changed

ActionButton.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ export default class ActionButton extends Component {
195195
]}
196196
>
197197
<Touchable
198+
testID={this.props.testID}
198199
background={touchableBackground(
199200
this.props.nativeFeedbackRippleColor,
200201
this.props.fixNativeFeedbackRadius
@@ -365,7 +366,9 @@ ActionButton.propTypes = {
365366

366367
useNativeFeedback: PropTypes.bool,
367368
fixNativeFeedbackRadius: PropTypes.bool,
368-
nativeFeedbackRippleColor: PropTypes.string
369+
nativeFeedbackRippleColor: PropTypes.string,
370+
371+
testID: PropTypes.string
369372
};
370373

371374
ActionButton.defaultProps = {
@@ -393,7 +396,8 @@ ActionButton.defaultProps = {
393396
useNativeFeedback: true,
394397
activeOpacity: DEFAULT_ACTIVE_OPACITY,
395398
fixNativeFeedbackRadius: false,
396-
nativeFeedbackRippleColor: "rgba(255,255,255,0.75)"
399+
nativeFeedbackRippleColor: "rgba(255,255,255,0.75)",
400+
testID: undefined
397401
};
398402

399403
const styles = StyleSheet.create({

ActionButtonItem.js

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
TouchableNativeFeedback,
99
TouchableWithoutFeedback,
1010
Dimensions,
11-
Platform,
1211
} from "react-native";
1312
import {
1413
shadowStyle,
@@ -86,36 +85,29 @@ export default class ActionButtonItem extends Component {
8685
};
8786

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

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

93-
const parentStyle = isAndroid &&
94-
this.props.fixNativeFeedbackRadius
95-
? {
96-
paddingHorizontal: this.props.offsetX,
97-
height: size + SHADOW_SPACE + spacing,
98-
borderRadius: this.props.size / 2
92+
const parentStyle = {
93+
marginHorizontal: this.props.offsetX,
94+
marginBottom: spacing + SHADOW_SPACE,
95+
borderRadius: this.props.size / 2,
9996
}
100-
: {
101-
paddingHorizontal: this.props.offsetX,
102-
height: size + SHADOW_SPACE + spacing
103-
};
97+
10498
return (
10599
<Animated.View
106100
pointerEvents="box-none"
107-
style={[animatedViewStyle, parentStyle]}
101+
style={[animatedViewStyle]}
108102
>
109-
<View
110-
style={[{
111-
width: this.props.size,
112-
height: this.props.size,
113-
borderRadius: size / 2
114-
},
115-
!hideShadow && Platform.OS === "android" ? {...shadowStyle, ...this.props.shadowStyle} : null
116-
]}
117-
>
103+
<View
104+
style={[
105+
parentStyle,
106+
!hideShadow && isAndroid ? {...shadowStyle, ...this.props.shadowStyle} : null
107+
]}
108+
>
118109
<Touchable
110+
testID={this.props.testID}
119111
background={touchableBackground(
120112
this.props.nativeFeedbackRippleColor,
121113
this.props.fixNativeFeedbackRadius
@@ -125,7 +117,7 @@ export default class ActionButtonItem extends Component {
125117
>
126118
<View style={[
127119
buttonStyle,
128-
!hideShadow && Platform.OS === "ios" ? {...shadowStyle, ...this.props.shadowStyle} : null
120+
!hideShadow && !isAndroid ? {...shadowStyle, ...this.props.shadowStyle} : null
129121
]}>
130122
{this.props.children}
131123
</View>

index.d.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import * as React from 'react'
2+
import {
3+
ViewStyle,
4+
ViewProperties,
5+
TextStyle
6+
} from 'react-native'
7+
8+
9+
export interface ActionButtonProperties extends ViewProperties {
10+
resetToken?: any,
11+
active?: boolean,
12+
13+
position?: string,
14+
elevation?: number,
15+
zIndex?: number,
16+
17+
hideShadow?: boolean,
18+
shadowStyle?: {} | [any] | number,
19+
bgColor?: string,
20+
bgOpacity?: number,
21+
buttonColor?: string,
22+
buttonTextStyle?: TextStyle,
23+
buttonText?: string,
24+
25+
offsetX?: number,
26+
offsetY?: number,
27+
spacing?: number,
28+
size?: number,
29+
autoInactive?: boolean,
30+
onPress?: () => void,
31+
backdrop?: boolean | object,
32+
degrees?: number,
33+
verticalOrientation?: 'up' | 'down',
34+
backgroundTappable?: boolean,
35+
activeOpacity?: number,
36+
37+
useNativeFeedback?: boolean,
38+
fixNativeFeedbackRadius?: boolean,
39+
nativeFeedbackRippleColor?: string
40+
}
41+
42+
export interface ActionButtonItemProperties extends ViewProperties {
43+
title?: string
44+
onPress?: () => void
45+
buttonColor?: string
46+
textContainerStyle?: ViewStyle
47+
textStyle?: TextStyle
48+
spaceBetween?: number
49+
activeOpacity?: number
50+
hideLabelShadow?: boolean
51+
shadowStyle?: ViewStyle
52+
useNativeFeedback?: boolean
53+
fixNativeFeedbackRadius?: boolean
54+
nativeFeedbackRippleColor?: string
55+
}
56+
57+
export class ActionButtonItem extends React.Component <ActionButtonItemProperties> {}
58+
export default class ActionButton extends React.Component <ActionButtonProperties> {
59+
static Item: typeof ActionButtonItem
60+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-action-button",
3-
"version": "2.8.0",
3+
"version": "2.8.3",
44
"description": "customizable multi-action-button component for react-native",
55
"main": "ActionButton.js",
66
"scripts": {

0 commit comments

Comments
 (0)