From 550469bb823592797c4c16090dd46b4d6bc3850f Mon Sep 17 00:00:00 2001 From: Libin Lu Date: Mon, 19 Dec 2016 15:51:01 -0800 Subject: [PATCH] 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 --- Libraries/Text/Text.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Libraries/Text/Text.js b/Libraries/Text/Text.js index 114732763..cb39fc79c 100644 --- a/Libraries/Text/Text.js +++ b/Libraries/Text/Text.js @@ -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;