mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-04-29 04:44:52 +08:00
[fix] React warning when using hitSlop prop
Make sure the hitSlop element has a 'key'. Fix #743
This commit is contained in:
@@ -65,8 +65,7 @@ class View extends Component<ViewProps> {
|
|||||||
if (hitSlop) {
|
if (hitSlop) {
|
||||||
const hitSlopStyle = calculateHitSlopStyle(hitSlop);
|
const hitSlopStyle = calculateHitSlopStyle(hitSlop);
|
||||||
const hitSlopChild = createElement('span', { style: [styles.hitSlop, hitSlopStyle] });
|
const hitSlopChild = createElement('span', { style: [styles.hitSlop, hitSlopStyle] });
|
||||||
otherProps.children = React.Children.toArray(otherProps.children);
|
otherProps.children = React.Children.toArray([ hitSlopChild, otherProps.children ]);
|
||||||
otherProps.children.unshift(hitSlopChild);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return createElement('div', otherProps);
|
return createElement('div', otherProps);
|
||||||
|
|||||||
Reference in New Issue
Block a user