Expose pressRetentionOffset for Text

Summary:
expose this property to make Text having same property like TouchableHighlight
Closes https://github.com/facebook/react-native/pull/11473

Differential Revision: D4348825

fbshipit-source-id: 941bcc681139d4460f52fed5174be1d2381462c7
This commit is contained in:
Libin Lu 2016-12-19 15:51:01 -08:00 committed by Facebook Github Bot
parent a19c6991c0
commit 550469bb82
1 changed files with 10 additions and 1 deletions

View File

@ -11,6 +11,7 @@
*/
'use strict';
const EdgeInsetsPropType = require('EdgeInsetsPropType');
const NativeMethodsMixin = require('NativeMethodsMixin');
const Platform = require('Platform');
const React = require('React');
@ -141,6 +142,14 @@ const Text = React.createClass({
* e.g., `onLongPress={this.increaseSize}>``
*/
onLongPress: React.PropTypes.func,
/**
* When the scroll view is disabled, this defines how far your touch may
* move off of the button, before deactivating the button. Once deactivated,
* try moving it back and you'll see that the button is once again
* reactivated! Move it back and forth several times while the scroll view
* is disabled. Ensure you pass in a constant to reduce memory allocations.
*/
pressRetentionOffset: EdgeInsetsPropType,
/**
* Lets the user select text, to use the native copy and paste functionality.
*/
@ -266,7 +275,7 @@ const Text = React.createClass({
};
this.touchableGetPressRectOffset = function(): RectOffset {
return PRESS_RECT_OFFSET;
return this.props.pressRetentionOffset || PRESS_RECT_OFFSET;
};
}
return setResponder;