Fixes a path in touchableHandlerResponderGrant method when touchableGetPressRectOffset method is not present.

Summary: Current code is checking presence of touchableGetPressRectOffset method but fails immediately on trying to get 'left' value of null.
Closes https://github.com/facebook/react-native/pull/3438

Reviewed By: @​svcscm

Differential Revision: D2545068

Pulled By: @javache

fb-gh-sync-id: d16cb46af1fc6eae02f56b2096c2169ce475e022
This commit is contained in:
Michal Aichinger 2015-10-15 06:35:52 -07:00 committed by facebook-github-bot-7
parent 4ec5161685
commit d0e40c581d
1 changed files with 12 additions and 10 deletions

View File

@ -420,16 +420,18 @@ var TouchableMixin = {
var positionOnActivate = this.state.touchable.positionOnActivate; var positionOnActivate = this.state.touchable.positionOnActivate;
var dimensionsOnActivate = this.state.touchable.dimensionsOnActivate; var dimensionsOnActivate = this.state.touchable.dimensionsOnActivate;
var pressRectOffset = this.touchableGetPressRectOffset ? var pressRectOffset = this.touchableGetPressRectOffset ?
this.touchableGetPressRectOffset() : null; this.touchableGetPressRectOffset() : {
var pressExpandLeft = left: PRESS_EXPAND_PX,
pressRectOffset.left != null ? pressRectOffset.left : PRESS_EXPAND_PX; right: PRESS_EXPAND_PX,
var pressExpandTop = top: PRESS_EXPAND_PX,
pressRectOffset.top != null ? pressRectOffset.top : PRESS_EXPAND_PX; bottom: PRESS_EXPAND_PX
var pressExpandRight = };
pressRectOffset.right != null ? pressRectOffset.right : PRESS_EXPAND_PX;
var pressExpandBottom = var pressExpandLeft = pressRectOffset.left;
pressRectOffset.bottom != null ? pressRectOffset.bottom : PRESS_EXPAND_PX; var pressExpandTop = pressRectOffset.top;
var pressExpandRight = pressRectOffset.right;
var pressExpandBottom = pressRectOffset.bottom;
var touch = TouchEventUtils.extractSingleTouch(e.nativeEvent); var touch = TouchEventUtils.extractSingleTouch(e.nativeEvent);
var pageX = touch && touch.pageX; var pageX = touch && touch.pageX;
var pageY = touch && touch.pageY; var pageY = touch && touch.pageY;