mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-20 14:05:09 +00:00
fix Text cannot handle touch events bug
This commit is contained in:
@@ -85,12 +85,12 @@ class GroupExample extends Component {
|
|||||||
width="120"
|
width="120"
|
||||||
viewBox="0 0 240 240"
|
viewBox="0 0 240 240"
|
||||||
>
|
>
|
||||||
<G>
|
<G onPress={() => alert('Pressed on G')}>
|
||||||
<G scale="1.4" onPress={() => alert('Pressed')}>
|
<G scale="1.4">
|
||||||
<G>
|
<G>
|
||||||
<Circle cx="80" cy="80" r="30" fill="green" x="20" scale="1.2"/>
|
<Circle cx="80" cy="80" r="30" fill="green" x="20" scale="1.2"/>
|
||||||
|
<Text fontWeight="bold" fontSize="40" x="100" y="100" scale="2" onPress={() => alert('Pressed on Text')}>H</Text>
|
||||||
<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>
|
|
||||||
</G>
|
</G>
|
||||||
</G>
|
</G>
|
||||||
</G>
|
</G>
|
||||||
|
|||||||
@@ -44,13 +44,11 @@ class Text extends Shape {
|
|||||||
y = props.dy ? +props.y + (+props.dy) : +props.y;
|
y = props.dy ? +props.y + (+props.dy) : +props.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return <RNSVGText
|
||||||
<RNSVGText
|
|
||||||
ref={ele => {this.root = ele;}}
|
ref={ele => {this.root = ele;}}
|
||||||
{...extractProps({...props, x, y})}
|
{...this.extractProps({...props, x, y})}
|
||||||
{...extractText(props)}
|
{...extractText(props)}
|
||||||
/>
|
/>;
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,6 @@
|
|||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UIView *view = [node hitTest: point withEvent:event withTransform:matrix];
|
UIView *view = [node hitTest: point withEvent:event withTransform:matrix];
|
||||||
|
|
||||||
if (view) {
|
if (view) {
|
||||||
|
|||||||
@@ -37,8 +37,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ([self getSvgView].responsible) {
|
if ([self getSvgView].responsible) {
|
||||||
NSLog(@"asdasdasdsadas");
|
|
||||||
|
|
||||||
// Add path to hitArea
|
// Add path to hitArea
|
||||||
CGMutablePathRef hitArea = CGPathCreateMutableCopy(path);
|
CGMutablePathRef hitArea = CGPathCreateMutableCopy(path);
|
||||||
if (self.stroke) {
|
if (self.stroke) {
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ const anchord = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function(props) {
|
export default function(props) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
alignment: anchord[props.textAnchor] || 0,
|
alignment: anchord[props.textAnchor] || 0,
|
||||||
frame: extractFontAndLines(
|
frame: extractFontAndLines(
|
||||||
|
|||||||
Reference in New Issue
Block a user