-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: pointer events getter #2395
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should move mPointerEvents
to RenderableView
as VirtualView
is also extended by DefinitionView
that shouldn't be pressable?
Related Closes #2239 to that problem. |
Summary: I maintain the `react-native-svg` library, where our elements extend `ReactViewGroup`. Currently, `ReactViewGroup` only exposes the getter for `mPointerEvents` publicly, so we cannot set it. To properly handle `pointerEvents`, we would have to duplicate all methods related to `mPointerEvents`, which results in maintaining a separate state. This duplication can lead to desynchronization between the state in our class and the state in the superclass. PR with a workaround that we can avoid with this change software-mansion/react-native-svg#2395 ## Changelog: [ANDROID] [CHANGED] - make `setPointerEvents` public Pull Request resolved: #45975 Test Plan: This change was tested manually by making the field public, allowing dependent classes to override or reference it. Reviewed By: cortinico Differential Revision: D61124293 Pulled By: javache fbshipit-source-id: 389d0a670375a8a68c975294f98c33c28ef41ffe
Summary
Regarding this issue, the PR adds a getter for
mPointerEvents
inVirtualView
class. Thanks to this, the pointer event type can be accessed from the RNSVG components in react-native-gesture-handler.Test Plan
You can test it by changing the
pointerEvents
value and checking if the 'tap' is logged when tapping on the red square: