[fix] iOS Touchable click handling

This commit is contained in:
Nicolas Gallagher
2016-07-12 10:26:00 -07:00
parent eb8aa0a9db
commit 5f3f4db7a6
2 changed files with 10 additions and 3 deletions
@@ -247,7 +247,7 @@ var TouchableHighlight = React.createClass({
onResponderRelease={this.touchableHandleResponderRelease}
onResponderTerminate={this.touchableHandleResponderTerminate}
ref={UNDERLAY_REF}
style={this.state.underlayStyle}
style={[ styles.root, this.state.underlayStyle ]}
tabIndex='0'
testID={this.props.testID}>
{React.cloneElement(
@@ -19,6 +19,7 @@ var Touchable = require('./Touchable');
var View = require('../View');
var ensurePositiveDelayProps = require('./ensurePositiveDelayProps');
var warning = require('fbjs/lib/warning');
var StyleSheet = require('../../apis/StyleSheet');
type Event = Object;
@@ -160,8 +161,8 @@ const TouchableWithoutFeedback = React.createClass({
children.push(Touchable.renderDebugView({color: 'red', hitSlop: this.props.hitSlop}));
}
const style = (Touchable.TOUCH_TARGET_DEBUG && child.type && child.type.displayName === 'Text') ?
[child.props.style, {color: 'red'}] :
child.props.style;
[styles.root, child.props.style, {color: 'red'}] :
[styles.root, child.props.style];
return (React: any).cloneElement(child, {
accessible: this.props.accessible !== false,
accessibilityLabel: this.props.accessibilityLabel,
@@ -182,4 +183,10 @@ const TouchableWithoutFeedback = React.createClass({
}
});
var styles = StyleSheet.create({
root: {
cursor: 'pointer'
}
});
module.exports = TouchableWithoutFeedback;