[fix] React warning when using hitSlop prop

Make sure the hitSlop element has a 'key'.

Fix #743
This commit is contained in:
Nicolas Gallagher
2017-12-30 14:06:33 -08:00
parent 41d90e0238
commit af47d5f414

View File

@@ -65,8 +65,7 @@ class View extends Component<ViewProps> {
if (hitSlop) {
const hitSlopStyle = calculateHitSlopStyle(hitSlop);
const hitSlopChild = createElement('span', { style: [styles.hitSlop, hitSlopStyle] });
otherProps.children = React.Children.toArray(otherProps.children);
otherProps.children.unshift(hitSlopChild);
otherProps.children = React.Children.toArray([ hitSlopChild, otherProps.children ]);
}
return createElement('div', otherProps);