[ReactNative] Pass events through to touchable handlers

Summary:
We want to be able to access the touch data within our components' event handlers, so we need to thread the event object all the way through to them.
This commit is contained in:
Bill Fisher
2015-08-21 01:52:13 -07:00
parent 2cd02d94ff
commit debca6d24f
5 changed files with 41 additions and 35 deletions

View File

@@ -17,6 +17,8 @@ var Touchable = require('Touchable');
var ensurePositiveDelayProps = require('ensurePositiveDelayProps');
var onlyChild = require('onlyChild');
type Event = Object;
/**
* 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
@@ -25,8 +27,6 @@ var onlyChild = require('onlyChild');
*/
var PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
type Event = Object;
/**
* Do not use unless you have a very good reason. All the elements that
* respond to press should have a visual feedback when touched. This is
@@ -79,16 +79,16 @@ var TouchableWithoutFeedback = React.createClass({
this.props.onPress && this.props.onPress(e);
},
touchableHandleActivePressIn: function() {
this.props.onPressIn && this.props.onPressIn();
touchableHandleActivePressIn: function(e: Event) {
this.props.onPressIn && this.props.onPressIn(e);
},
touchableHandleActivePressOut: function() {
this.props.onPressOut && this.props.onPressOut();
touchableHandleActivePressOut: function(e: Event) {
this.props.onPressOut && this.props.onPressOut(e);
},
touchableHandleLongPress: function() {
this.props.onLongPress && this.props.onLongPress();
touchableHandleLongPress: function(e: Event) {
this.props.onLongPress && this.props.onLongPress(e);
},
touchableGetPressRectOffset: function(): typeof PRESS_RECT_OFFSET {