mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-20 14:05:09 +00:00
Add nested G on touchEvents Example
This commit is contained in:
@@ -81,11 +81,13 @@ class GroupExample extends Component {
|
|||||||
width="120"
|
width="120"
|
||||||
viewBox="0 0 240 240"
|
viewBox="0 0 240 240"
|
||||||
>
|
>
|
||||||
|
<G>
|
||||||
<G onPress={() => alert('Pressed')}>
|
<G onPress={() => alert('Pressed')}>
|
||||||
<Circle cx="80" cy="80" r="30" fill="green" x="20" />
|
<Circle cx="80" cy="80" r="30" fill="green" x="20" />
|
||||||
<Rect x="20" y="20" width="40" height="40" fill="yellow"/>
|
<Rect x="20" y="20" width="40" height="40" fill="yellow"/>
|
||||||
<Text fontWeight="bold" fontSize="40" x="100" y="100" scale="2">H</Text>
|
<Text fontWeight="bold" fontSize="40" x="100" y="100" scale="2">H</Text>
|
||||||
</G>
|
</G>
|
||||||
|
</G>
|
||||||
</Svg>;
|
</Svg>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public class RNSVGGroupShadowNode extends RNSVGPathShadowNode {
|
|||||||
View childView = ((ViewGroup) view).getChildAt(i);
|
View childView = ((ViewGroup) view).getChildAt(i);
|
||||||
viewTag = node.hitTest(point, childView, combinedMatrix);
|
viewTag = node.hitTest(point, childView, combinedMatrix);
|
||||||
if (viewTag != -1) {
|
if (viewTag != -1) {
|
||||||
return (node.isResponsible() || (viewTag != childView.getId())) ? viewTag : view.getId();
|
return (node.isResponsible() || viewTag != childView.getId()) ? viewTag : view.getId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user