From 5f3f4db7a6153af9f3beeb5df19f009538fc0d83 Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Tue, 12 Jul 2016 10:26:00 -0700 Subject: [PATCH] [fix] iOS Touchable click handling --- src/components/Touchable/TouchableHighlight.js | 2 +- src/components/Touchable/TouchableWithoutFeedback.js | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/Touchable/TouchableHighlight.js b/src/components/Touchable/TouchableHighlight.js index c2f35260..5da588d6 100644 --- a/src/components/Touchable/TouchableHighlight.js +++ b/src/components/Touchable/TouchableHighlight.js @@ -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( diff --git a/src/components/Touchable/TouchableWithoutFeedback.js b/src/components/Touchable/TouchableWithoutFeedback.js index b308309e..aca47c68 100644 --- a/src/components/Touchable/TouchableWithoutFeedback.js +++ b/src/components/Touchable/TouchableWithoutFeedback.js @@ -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;