Skip to content

Commit

Permalink
Fix TouchNativeFeedback so that the ripple starts from where a person…
Browse files Browse the repository at this point in the history
… touches

Summary:
It needs the touch coordinates for with-in the element, not for on the page.
Closes facebook#5400

Reviewed By: svcscm

Differential Revision: D2848834

Pulled By: androidtrunkagent

fb-gh-sync-id: 88cf0fd7bd2332eb3db835b26438064412c8358c
  • Loading branch information
Jeff Berg authored and facebook-github-bot-2 committed Jan 21, 2016
1 parent f3e2c29 commit 48117ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Libraries/Components/Touchable/Touchable.js
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,9 @@ var TouchableMixin = {
var touch = TouchEventUtils.extractSingleTouch(e.nativeEvent);
var pageX = touch && touch.pageX;
var pageY = touch && touch.pageY;
this.pressInLocation = {pageX: pageX, pageY: pageY};
var locationX = touch && touch.locationX;
var locationY = touch && touch.locationY;
this.pressInLocation = {pageX, pageY, locationX, locationY};
},

_getDistanceBetweenPoints: function (aX, aY, bX, bY) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ var TouchableNativeFeedback = React.createClass({
touchableHandleActivePressIn: function() {
this.props.onPressIn && this.props.onPressIn();
this._dispatchPressedStateChange(true);
this._dispatchHotspotUpdate(this.pressInLocation.pageX, this.pressInLocation.pageY);
this._dispatchHotspotUpdate(this.pressInLocation.locationX, this.pressInLocation.locationY);
},

touchableHandleActivePressOut: function() {
Expand Down

0 comments on commit 48117ce

Please sign in to comment.