Skip to content
This repository has been archived by the owner on May 18, 2023. It is now read-only.

Commit

Permalink
Adds support for android devices
Browse files Browse the repository at this point in the history
  • Loading branch information
trippcr committed Dec 30, 2015
1 parent 9e33f78 commit ce2b048
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ var Swipeout = React.createClass({
return true;
}
, _handleMoveShouldSetPanResponder: function(e: Object, gestureState: Object): boolean {
if (gestureState.dx === 0 || gestureState.dy === 0) {
if (Math.abs(gestureState.dx) < 2 || Math.abs(gestureState.dy) < 2) {
return false;
}
return true;
Expand Down Expand Up @@ -217,6 +217,13 @@ var Swipeout = React.createClass({
openedLeft: false,
})
}
, _onLayout: function(event) {
var { width, height } = event.nativeEvent.layout;
this.setState({
contentWidth: width,
contentHeight: height,
})
}
, render: function() {
var self = this
var contentWidth = self.state.contentWidth
Expand Down Expand Up @@ -260,7 +267,7 @@ var Swipeout = React.createClass({

return (
<View style={styleSwipeout}>
<View ref="swipeoutContent" style={styleContent} {...self._panResponder.panHandlers}>
<View ref="swipeoutContent" style={styleContent} {...self._panResponder.panHandlers} onLayout={this._onLayout}>
{self.props.children}
</View>
{self.props.right && posX < 0 ?
Expand Down

5 comments on commit ce2b048

@wvengen
Copy link

Choose a reason for hiding this comment

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

This saved my day 👍
You could consider making the 2 somewhat configurable, I would think it depends on resolution and use-case ("parkinson mode").

@trippcr
Copy link
Owner Author

@trippcr trippcr commented on ce2b048 Jan 4, 2016

Choose a reason for hiding this comment

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

Glad to hear it! And very true about the magic number, I was just trying to make as few as changes as possible and have it work for my app.

@npomfret
Copy link

Choose a reason for hiding this comment

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

I've testing this on IOS and android API 23, works like a charm - thanks. Any chance of getting a new release?

@npomfret
Copy link

Choose a reason for hiding this comment

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

Hi - did this get released yet?

@wvengen
Copy link

Choose a reason for hiding this comment

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

Not yet, unfortunately - dancormier#60

Please sign in to comment.