react-native-svg icon indicating copy to clipboard operation
react-native-svg copied to clipboard

Android onPress Problem

Open xcandev opened this issue 3 years ago • 8 comments

Hello friends. The function in the line of code below works fine on IOS, but not on Android. Why could it be?

<Path 
 onPress={() => changeCeiling(ceilingCount === 0 ? "#F7CB52" : ceilingCount === 1 ? "#EB4573" : "#00B8FE")} fill={ceiling} 
 id="Path_3647" 
 data-name="Path 3647" 
 d="M4398.123,8491.008c.222,7.107,0,15.558,0,15.558v39.352s17.227,4.751,33.4,4.82a119.782,119.782,0,0,0,31.286-4.546l-.116-40.973s-.016-7.205.706-14.211S4397.9,8483.9,4398.123,8491.008Z" 
 transform="translate(-4243.262 -8053.945)" 
 stroke="#707070" 
 stroke-width="1" 
/>

xcandev avatar Sep 07 '22 15:09 xcandev

What's your react-native-svg version? I tried with 12.x and 13.x, I have no problem with on press event on Android.

TomCorvus avatar Sep 12 '22 12:09 TomCorvus

Hello @TomCorvus

I can give an expo on Android if you want. "react-native-svg": "12.3.0"

My problem still persists.

xcandev avatar Sep 14 '22 16:09 xcandev

hi @ugurcanalyuz Yes please, if you can provide an example.

TomCorvus avatar Sep 14 '22 16:09 TomCorvus

Hello @TomCorvus https://snack.expo.dev/@atlteknoloji/rn-svg-android-problem

IOS is so good Working and Android hard working :)

xcandev avatar Sep 15 '22 00:09 xcandev

Hello @TomCorvus, Have you had a chance to review?

xcandev avatar Sep 23 '22 19:09 xcandev

@ugurcanalyuz I checked but I have no fix for now. onPress event on paths on left and right of your SVG is working on both platforms for me but not paths on center. If I log onPress event, it is the Svg onPress event which is triggered not path. Do you have same behavior? It's maybe the same problem as https://github.com/react-native-svg/react-native-svg/issues/1826 I'll edit this message if I find something.

TomCorvus avatar Sep 26 '22 07:09 TomCorvus

Solution: use onPressIn instead of onPress.

maxoschepkov avatar Feb 01 '23 14:02 maxoschepkov

I just encountered this issue, seems like it's related to the default touchableHandleResponderMove function and the scale of the svg, i would have loved to open a PR with a fix, but i still haven't been able to fix it.

RodSarhan avatar Nov 18 '24 06:11 RodSarhan