software-mansion / react-native-svg

SVG library for React Native, React Native Web, and plain React web projects.
MIT License
7.34k stars 1.11k forks source link

wrong onPressIn callback called when rendering a list of shapes and using a pencil/stylus! #2313

Closed mgcrea closed 1 day ago

mgcrea commented 6 days ago

Description

I am encountering a strange intermittent bug that does not happen on every app start but when it happens it will trigger consistently during the lifecycle of the app, can only be triggered with a pencil/stylus (Apple Pencil)

I have a rect with resize anchors (eg. corner circles) that can be pressed, when pressed (using pressIn), I log the id of the pressed item.

On some app start I will have one pressIn every two that will incorrectly call the previous callback (so you get the same callback called twice whatever anchor you pressed) when taped with the Apple pencil, will work properly with a touch tap or a mouse.

Thought it might be a react bug but I can't reproduce it with similar code using plain Views (cf. the repro that has both side by side).

Tried to debug in Xcode with breakpoints but no luck for now (not my strong suit).

Happy to dig further if given guidance!

Steps to reproduce

  1. git clone --branch bug-react-native-svg-1 --single-branch https://github.com/mgcrea/react-native-reanimated-sandbox.git
  2. pnpm install; npx pod-install
  3. kill and restart the app until the buggy behaviour occurs (alternate between two anchors should be buggy and a warning should appear)

Snack or a link to a repository

https://github.com/mgcrea/react-native-reanimated-sandbox/tree/bug-react-native-svg-1

SVG version

15.3.0

React Native version

0.74.2

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native

Architecture

Paper (Old Architecture)

Build type

Release app & dev bundle

Device

Real device

Device model

iPad Pro 13"

Acknowledgements

Yes

github-actions[bot] commented 6 days ago

Hey! 👋

It looks like you've omitted a few important sections from the issue template.

Please complete React-native-svg version section.

mgcrea commented 1 day ago

Tried to implement the behaviour with react-native-skia & gesture-handler to pinpoint the active element and got the same buggy behaviour, from what I can see the coordinates are actually wrong so it is probably a react-native bug. Will close this as I have reproduced it without RNSVG.