Add nested G on touchEvents Example

This commit is contained in:
Horcrux
2016-08-06 09:29:38 +08:00
parent 2dc34c8fe5
commit 72ca2cc573
2 changed files with 7 additions and 5 deletions

View File

@@ -81,10 +81,12 @@ class GroupExample extends Component {
width="120"
viewBox="0 0 240 240"
>
<G onPress={() => alert('Pressed')}>
<Circle cx="80" cy="80" r="30" fill="green" x="20" />
<Rect x="20" y="20" width="40" height="40" fill="yellow"/>
<Text fontWeight="bold" fontSize="40" x="100" y="100" scale="2">H</Text>
<G>
<G onPress={() => alert('Pressed')}>
<Circle cx="80" cy="80" r="30" fill="green" x="20" />
<Rect x="20" y="20" width="40" height="40" fill="yellow"/>
<Text fontWeight="bold" fontSize="40" x="100" y="100" scale="2">H</Text>
</G>
</G>
</Svg>;
}

View File

@@ -94,7 +94,7 @@ public class RNSVGGroupShadowNode extends RNSVGPathShadowNode {
View childView = ((ViewGroup) view).getChildAt(i);
viewTag = node.hitTest(point, childView, combinedMatrix);
if (viewTag != -1) {
return (node.isResponsible() || (viewTag != childView.getId())) ? viewTag : view.getId();
return (node.isResponsible() || viewTag != childView.getId()) ? viewTag : view.getId();
}
}