Expose the touch-retention offset as a prop

Summary: The touch-retention offset defines a rect around a touchable component in which the touch is retained. Easiest way to see this is to touch a button in a real navigation bar and slide your finger out of the range and back in. This diff exposes the offset as a prop (I thought touchRetentionOffset was a more informative name than pressRectOffset)

Fixes #198
Closes https://github.com/facebook/react-native/pull/713

Reviewed By: svcscm

Differential Revision: D2115370

Pulled By: shayne

fb-gh-sync-id: c3f57940dfa3806f9c88df03a01d4d65bb58cf32
This commit is contained in:
James Ide
2015-11-16 13:51:13 -08:00
committed by facebook-github-bot-7
parent 5217c8273f
commit f331d2a844
5 changed files with 37 additions and 36 deletions

View File

@@ -47,7 +47,7 @@ var TouchableView = createReactNativeComponentClass({
uiViewClassName: 'RCTView',
});
var PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
/**
* A wrapper for making views respond properly to touches (Android only).
@@ -161,7 +161,8 @@ var TouchableNativeFeedback = React.createClass({
},
touchableGetPressRectOffset: function() {
return PRESS_RECT_OFFSET; // Always make sure to predeclare a constant!
// Always make sure to predeclare a constant!
return this.props.pressRetentionOffset || PRESS_RETENTION_OFFSET;
},
touchableGetHighlightDelayMS: function() {