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,15 +420,17 @@ var TouchableMixin = {
var positionOnActivate = this.state.touchable.positionOnActivate;
var dimensionsOnActivate = this.state.touchable.dimensionsOnActivate;
var pressRectOffset = this.touchableGetPressRectOffset ?
this.touchableGetPressRectOffset() : null;
var pressExpandLeft =
pressRectOffset.left != null ? pressRectOffset.left : PRESS_EXPAND_PX;
var pressExpandTop =
pressRectOffset.top != null ? pressRectOffset.top : PRESS_EXPAND_PX;
var pressExpandRight =
pressRectOffset.right != null ? pressRectOffset.right : PRESS_EXPAND_PX;
var pressExpandBottom =
pressRectOffset.bottom != null ? pressRectOffset.bottom : PRESS_EXPAND_PX;
this.touchableGetPressRectOffset() : {
left: PRESS_EXPAND_PX,
right: PRESS_EXPAND_PX,
top: PRESS_EXPAND_PX,
bottom: PRESS_EXPAND_PX
};
var pressExpandLeft = pressRectOffset.left;
var pressExpandTop = pressRectOffset.top;
var pressExpandRight = pressRectOffset.right;
var pressExpandBottom = pressRectOffset.bottom;
var touch = TouchEventUtils.extractSingleTouch(e.nativeEvent);
var pageX = touch && touch.pageX;