Skip to content

Commit

Permalink
Text component: Pass event object to onPress and onLongPress handlers
Browse files Browse the repository at this point in the history
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 #9657

Differential Revision: D3790550

fbshipit-source-id: 026b579ef6b354d9519abd5e9a92f0d562159132
  • Loading branch information
Adam Comella authored and Facebook Github Bot 9 committed Aug 30, 2016
1 parent fd34844 commit 158a73b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Libraries/Text/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 158a73b

Please sign in to comment.