Skip to content

Commit

Permalink
solved merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
micnil committed Dec 19, 2017
2 parents a37ce1e + cd06f74 commit f27528a
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 26 deletions.
8 changes: 6 additions & 2 deletions ActionButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ export default class ActionButton extends Component {
]}
>
<Touchable
testID={this.props.testID}
background={touchableBackground(
this.props.nativeFeedbackRippleColor,
this.props.fixNativeFeedbackRadius
Expand Down Expand Up @@ -365,7 +366,9 @@ ActionButton.propTypes = {

useNativeFeedback: PropTypes.bool,
fixNativeFeedbackRadius: PropTypes.bool,
nativeFeedbackRippleColor: PropTypes.string
nativeFeedbackRippleColor: PropTypes.string,

testID: PropTypes.string
};

ActionButton.defaultProps = {
Expand Down Expand Up @@ -393,7 +396,8 @@ ActionButton.defaultProps = {
useNativeFeedback: true,
activeOpacity: DEFAULT_ACTIVE_OPACITY,
fixNativeFeedbackRadius: false,
nativeFeedbackRippleColor: "rgba(255,255,255,0.75)"
nativeFeedbackRippleColor: "rgba(255,255,255,0.75)",
testID: undefined
};

const styles = StyleSheet.create({
Expand Down
38 changes: 15 additions & 23 deletions ActionButtonItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
TouchableNativeFeedback,
TouchableWithoutFeedback,
Dimensions,
Platform,
} from "react-native";
import {
shadowStyle,
Expand Down Expand Up @@ -86,36 +85,29 @@ 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
? {
paddingHorizontal: this.props.offsetX,
height: size + SHADOW_SPACE + spacing,
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
style={[{
width: this.props.size,
height: this.props.size,
borderRadius: size / 2
},
!hideShadow && Platform.OS === "android" ? {...shadowStyle, ...this.props.shadowStyle} : null
]}
>
<View
style={[
parentStyle,
!hideShadow && isAndroid ? {...shadowStyle, ...this.props.shadowStyle} : null
]}
>
<Touchable
testID={this.props.testID}
background={touchableBackground(
this.props.nativeFeedbackRippleColor,
this.props.fixNativeFeedbackRadius
Expand All @@ -125,7 +117,7 @@ export default class ActionButtonItem extends Component {
>
<View style={[
buttonStyle,
!hideShadow && Platform.OS === "ios" ? {...shadowStyle, ...this.props.shadowStyle} : null
!hideShadow && !isAndroid ? {...shadowStyle, ...this.props.shadowStyle} : null
]}>
{this.props.children}
</View>
Expand Down
60 changes: 60 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import * as React from 'react'
import {
ViewStyle,
ViewProperties,
TextStyle
} from 'react-native'


export interface ActionButtonProperties extends ViewProperties {
resetToken?: any,
active?: boolean,

position?: string,
elevation?: number,
zIndex?: number,

hideShadow?: boolean,
shadowStyle?: {} | [any] | number,
bgColor?: string,
bgOpacity?: number,
buttonColor?: string,
buttonTextStyle?: TextStyle,
buttonText?: string,

offsetX?: number,
offsetY?: number,
spacing?: number,
size?: number,
autoInactive?: boolean,
onPress?: () => void,
backdrop?: boolean | object,
degrees?: number,
verticalOrientation?: 'up' | 'down',
backgroundTappable?: boolean,
activeOpacity?: number,

useNativeFeedback?: boolean,
fixNativeFeedbackRadius?: boolean,
nativeFeedbackRippleColor?: string
}

export interface ActionButtonItemProperties extends ViewProperties {
title?: string
onPress?: () => void
buttonColor?: string
textContainerStyle?: ViewStyle
textStyle?: TextStyle
spaceBetween?: number
activeOpacity?: number
hideLabelShadow?: boolean
shadowStyle?: ViewStyle
useNativeFeedback?: boolean
fixNativeFeedbackRadius?: boolean
nativeFeedbackRippleColor?: string
}

export class ActionButtonItem extends React.Component <ActionButtonItemProperties> {}
export default class ActionButton extends React.Component <ActionButtonProperties> {
static Item: typeof ActionButtonItem
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-action-button",
"version": "2.8.0",
"version": "2.8.3",
"description": "customizable multi-action-button component for react-native",
"main": "ActionButton.js",
"scripts": {
Expand Down

1 comment on commit f27528a

@iCodePup
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job . Thanks

Please sign in to comment.