From 158a73b8a59b90fc36cd157514e78076ed06e1c3 Mon Sep 17 00:00:00 2001 From: Adam Comella Date: Tue, 30 Aug 2016 05:35:45 -0700 Subject: [PATCH] Text component: Pass event object to onPress and onLongPress handlers Summary: This makes the Text component more consistent with the contracts implemented by the Touchable* components. **Test plan (required)** Verified the event object gets passed to the `onPress` and `onLongPress` handlers in a test app. Also, this change is being used by my team's app. Adam Comella Microsoft Corp. Closes https://github.com/facebook/react-native/pull/9657 Differential Revision: D3790550 fbshipit-source-id: 026b579ef6b354d9519abd5e9a92f0d562159132 --- Libraries/Text/Text.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Libraries/Text/Text.js b/Libraries/Text/Text.js index 710d8f861..9fa9a6672 100644 --- a/Libraries/Text/Text.js +++ b/Libraries/Text/Text.js @@ -255,12 +255,12 @@ const Text = React.createClass({ }); }; - this.touchableHandlePress = () => { - this.props.onPress && this.props.onPress(); + this.touchableHandlePress = (e: SyntheticEvent) => { + this.props.onPress && this.props.onPress(e); }; - this.touchableHandleLongPress = () => { - this.props.onLongPress && this.props.onLongPress(); + this.touchableHandleLongPress = (e: SyntheticEvent) => { + this.props.onLongPress && this.props.onLongPress(e); }; this.touchableGetPressRectOffset = function(): RectOffset {