mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-07 23:27:05 +08:00
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:
committed by
facebook-github-bot-7
parent
5217c8273f
commit
f331d2a844
@@ -34,6 +34,8 @@ var DEFAULT_PROPS = {
|
||||
underlayColor: 'black',
|
||||
};
|
||||
|
||||
var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
||||
|
||||
/**
|
||||
* A wrapper for making views respond properly to touches.
|
||||
* On press down, the opacity of the wrapped view is decreased, which allows
|
||||
@@ -169,7 +171,7 @@ var TouchableHighlight = React.createClass({
|
||||
},
|
||||
|
||||
touchableGetPressRectOffset: function() {
|
||||
return PRESS_RECT_OFFSET; // Always make sure to predeclare a constant!
|
||||
return this.props.pressRetentionOffset || PRESS_RETENTION_OFFSET;
|
||||
},
|
||||
|
||||
touchableGetHighlightDelayMS: function() {
|
||||
@@ -234,7 +236,6 @@ var TouchableHighlight = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
var PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
||||
var CHILD_REF = keyOf({childRef: null});
|
||||
var UNDERLAY_REF = keyOf({underlayRef: null});
|
||||
var INACTIVE_CHILD_PROPS = {
|
||||
|
||||
Reference in New Issue
Block a user