Skip to content

Commit

Permalink
Merge pull request #2 from Cryptolemming/patch-1
Browse files Browse the repository at this point in the history
Update PanDemo.js
  • Loading branch information
bonniee committed Jan 10, 2016
2 parents 03c26f7 + d05571e commit fd9823e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions Touch/PanDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ var PanResponderExample = React.createClass({
this._previousLeft = 20;
this._previousTop = 84;
this._circleStyles = {
left: this._previousLeft,
top: this._previousTop,
style: {
left: this._previousLeft,
top: this._previousTop,
}
};
},

Expand Down Expand Up @@ -82,13 +84,17 @@ var PanResponderExample = React.createClass({
// providing visual feedback to the user.
_highlight: function() {
this.circle && this.circle.setNativeProps({
backgroundColor: CIRCLE_HIGHLIGHT_COLOR
style: {
backgroundColor: CIRCLE_HIGHLIGHT_COLOR
}
});
},

_unHighlight: function() {
this.circle && this.circle.setNativeProps({
backgroundColor: CIRCLE_COLOR
style: {
backgroundColor: CIRCLE_COLOR
}
});
},

Expand Down Expand Up @@ -126,8 +132,8 @@ var PanResponderExample = React.createClass({
});

// Calculate current position using deltas
this._circleStyles.left = this._previousLeft + gestureState.dx;
this._circleStyles.top = this._previousTop + gestureState.dy;
this._circleStyles.style.left = this._previousLeft + gestureState.dx;
this._circleStyles.style.top = this._previousTop + gestureState.dy;
this._updatePosition();
},
_handlePanResponderEnd: function(e: Object, gestureState: Object) {
Expand All @@ -153,4 +159,4 @@ var styles = StyleSheet.create({
},
});

module.exports = PanResponderExample;
module.exports = PanResponderExample;

0 comments on commit fd9823e

Please sign in to comment.