Skip to content
This repository has been archived by the owner on Sep 16, 2020. It is now read-only.

added sensitivityY support to distinct dx and dy of gestureState. #325

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
18 changes: 10 additions & 8 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ var Swipeout = (0, _createReactClass2.default)({
right: _propTypes2.default.array,
scroll: _propTypes2.default.func,
style: (_reactNative.ViewPropTypes || _reactNative.View.propTypes).style,
sensitivity: _propTypes2.default.number,
sensitivityX: _propTypes2.default.number,
sensitivityY: _propTypes2.default.number,
buttonWidth: _propTypes2.default.number,
disabled: _propTypes2.default.bool
},
Expand All @@ -134,7 +135,8 @@ var Swipeout = (0, _createReactClass2.default)({
disabled: false,
rowID: -1,
sectionID: -1,
sensitivity: 50
sensitivityX: 50,
sensitivityY: 50
};
},

Expand Down Expand Up @@ -165,7 +167,7 @@ var Swipeout = (0, _createReactClass2.default)({
return _this.state.openedLeft || _this.state.openedRight;
},
onMoveShouldSetPanResponderCapture: function onMoveShouldSetPanResponderCapture(event, gestureState) {
return Math.abs(gestureState.dx) > _this.props.sensitivity && Math.abs(gestureState.dy) <= _this.props.sensitivity;
return Math.abs(gestureState.dx) > _this.props.sensitivityX && Math.abs(gestureState.dy) <= _this.props.sensitivityY;
},
onPanResponderGrant: this._handlePanResponderGrant,
onPanResponderMove: this._handlePanResponderMove,
Expand All @@ -190,11 +192,11 @@ var Swipeout = (0, _createReactClass2.default)({
var _this2 = this;

if (this.props.disabled) return;
if (!this.state.openedLeft && !this.state.openedRight) {
this._callOnOpen();
} else {
this._callOnClose();
}
// if (!this.state.openedLeft && !this.state.openedRight) {
// this._callOnOpen();
// } else {
// this._callOnClose();
// }
this.refs.swipeoutContent.measure(function (ox, oy, width, height) {
var buttonWidth = _this2.props.buttonWidth || width / 5;
_this2.setState({
Expand Down
3 changes: 2 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ declare module 'react-native-swipeout' {
right?: SwipeoutButtonProperties[];
scroll?(scrollEnabled: boolean): void;
style?: Object;
sensitivity?: number;
sensitivityX?: number;
sensitivityY?: number;
buttonWidth?: number;
rowId?: number;
sectionId?: number;
Expand Down