diff --git a/Libraries/Components/Touchable/TouchableNativeFeedback.android.js b/Libraries/Components/Touchable/TouchableNativeFeedback.android.js index db99fbde1..292d9356a 100644 --- a/Libraries/Components/Touchable/TouchableNativeFeedback.android.js +++ b/Libraries/Components/Touchable/TouchableNativeFeedback.android.js @@ -16,6 +16,7 @@ const ReactNative = require('ReactNative'); const Touchable = require('Touchable'); const TouchableWithoutFeedback = require('TouchableWithoutFeedback'); const UIManager = require('UIManager'); +const View = require('View'); const createReactClass = require('create-react-class'); const ensurePositiveDelayProps = require('ensurePositiveDelayProps'); @@ -238,7 +239,7 @@ const TouchableNativeFeedback = createReactClass({ render: function() { const child = React.Children.only(this.props.children); let children = child.props.children; - if (Touchable.TOUCH_TARGET_DEBUG && child.type.displayName === 'View') { + if (Touchable.TOUCH_TARGET_DEBUG && child.type === View) { if (!Array.isArray(children)) { children = [children]; } diff --git a/Libraries/Components/Touchable/TouchableWithoutFeedback.js b/Libraries/Components/Touchable/TouchableWithoutFeedback.js index 06af8ab40..3bb69617e 100755 --- a/Libraries/Components/Touchable/TouchableWithoutFeedback.js +++ b/Libraries/Components/Touchable/TouchableWithoutFeedback.js @@ -15,6 +15,7 @@ const React = require('React'); const PropTypes = require('prop-types'); const TimerMixin = require('react-timer-mixin'); const Touchable = require('Touchable'); +const View = require('View'); const createReactClass = require('create-react-class'); const ensurePositiveDelayProps = require('ensurePositiveDelayProps'); @@ -225,28 +226,12 @@ const TouchableWithoutFeedback = ((createReactClass({ // $FlowFixMe(>=0.41.0) const child = React.Children.only(this.props.children); let children = child.props.children; - warning( - !child.type || child.type.displayName !== 'Text', - 'TouchableWithoutFeedback does not work well with Text children. Wrap children in a View instead. See ' + - ((child._owner && child._owner.getName && child._owner.getName()) || - ''), - ); - if ( - Touchable.TOUCH_TARGET_DEBUG && - child.type && - child.type.displayName === 'View' - ) { + if (Touchable.TOUCH_TARGET_DEBUG && child.type === View) { children = React.Children.toArray(children); 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; return (React: any).cloneElement(child, { accessible: this.props.accessible !== false, accessibilityLabel: this.props.accessibilityLabel, @@ -266,7 +251,6 @@ const TouchableWithoutFeedback = ((createReactClass({ onResponderMove: this.touchableHandleResponderMove, onResponderRelease: this.touchableHandleResponderRelease, onResponderTerminate: this.touchableHandleResponderTerminate, - style, children, }); },