Permalink
Browse files

fix Touchables inspector

Summary:
Fix TouchableWithoutFeedback throw error when touchables inspector is shown in react@15.4.0:
`Attempted to assign to readonly property`
![image](https://cloud.githubusercontent.com/assets/7693239/20824463/14f7bfc8-b898-11e6-9bc3-50434492ee40.png)

Convert children into an array by using React.Children.toArray.
Closes #11262

Differential Revision: D4329147

fbshipit-source-id: 38c9f78b5a81964efccacc7a08b66dda7acb7dc5
  • Loading branch information...
magicismight authored and facebook-github-bot committed Dec 23, 2016
1 parent 68f6259 commit 5f8d7ac61817f7cb9fa08a39c513a1114f69746e
Showing with 1 addition and 3 deletions.
  1. +1 −3 Libraries/Components/Touchable/TouchableWithoutFeedback.js
@@ -157,9 +157,7 @@ const TouchableWithoutFeedback = React.createClass({
((child._owner && child._owner.getName && child._owner.getName()) || '<unknown>')
);
if (Touchable.TOUCH_TARGET_DEBUG && child.type && child.type.displayName === 'View') {
if (!Array.isArray(children)) {
children = [children];
}
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') ?

0 comments on commit 5f8d7ac

Please sign in to comment.