Fix TouchNativeFeedback so that the ripple starts from where a person touches

Summary:
It needs the touch coordinates for with-in the element, not for on the page.
Closes https://github.com/facebook/react-native/pull/5400

Reviewed By: svcscm

Differential Revision: D2848834

Pulled By: androidtrunkagent

fb-gh-sync-id: 88cf0fd7bd2332eb3db835b26438064412c8358c
This commit is contained in:
Jeff Berg 2016-01-20 20:35:18 -08:00 committed by facebook-github-bot-2
parent f3e2c29220
commit 48117ce6c4
2 changed files with 4 additions and 2 deletions

View File

@ -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) {

View File

@ -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() {