onPress在使用react-native-svg的iOS上的SVG路径上不起作用

当我在下面所示的弧上按任意位置时,在Android上,总是正确调用onPress,但在iOS上,有时会调用onPress,但有时却没有。弧的某些部分在iOS上无法点击。

此外,弧上没有任何定位元素(绝对/相对定位)。

这是我的代码。

<Svg
   height={deviceHeight - 200}
   width={deviceWidth}
>
    <Path
       ref={ref => this.pathRef = ref}
       fill="none"
       stroke='rgba(214,51,.2)'
       strokeWidth={35}
       onPress={() => console.log('path on pressed called!')}
       d="M 392.72727272727275 124.90909090909088 A 360 450 0 0 0 42.72727272727275 574.9090909090909"
    />
</Svg>

onPress在使用react-native-svg的iOS上的SVG路径上不起作用

我还已经在react-native-svg软件包中记录了一个问题:https://github.com/react-native-community/react-native-svg/issues/1256

zhiyliu8 回答:onPress在使用react-native-svg的iOS上的SVG路径上不起作用

在react-native-svg中,可以使用“符号”组件,它将所有元素分组为一个元素,然后将onPress()添加到该符号。它将适用于所有绝对/相对内容。

<Svg height="150" width="110">
  <Symbol id="symbol" viewBox="0 0 150 110" width="100" height="50">
    //------------------------------
    // Your content for that arc
    //------------------------------
  </Symbol>
</Svg>
本文链接:https://www.f2er.com/2720593.html

大家都在问