Skip to content
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

feat: make svgView getter public #2583

Merged
merged 3 commits into from
Jan 15, 2025
Merged

Conversation

latekvo
Copy link
Contributor

@latekvo latekvo commented Dec 18, 2024

Summary

This PR reverts #2555, as RenderableView.hitTest() can be replaced by SvgView.reactTagForTouch(), which is already public.

This PR also changes the package-private getSvgView() method of VirtualView to public.
This change has been made to handle hit detection of transformed VirtualViews, as RenderableView's hitTest() doesn't take transformations into account, while SvgView's reactTagForTouch() does.

Making getSvgView() public is necessary for integrating RNSVG support into RNGH. More details here.

Test Plan

Run the example from the RNGH - RNSVG integration PR.

What's required for testing (prerequisites)?

What are the steps to reproduce (after prerequisites)?

Compatibility

OS Implemented
iOS
MacOS
Android
Web

Checklist

  • I have tested this on a device and a simulator
  • I added documentation in README.md
  • I updated the typed files (typescript)
  • I added a test for the API in the __tests__ folder

Copy link
Member

@jakex7 jakex7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jakex7 jakex7 merged commit 3bf4298 into main Jan 15, 2025
3 of 4 checks passed
@jakex7 jakex7 deleted the @latekvo/make-svg-view-getter-public branch January 15, 2025 10:27
latekvo added a commit to software-mansion/react-native-gesture-handler that referenced this pull request Feb 25, 2025
## Description

<!--
Description and motivation for this PR.

Include 'Fixes #<number>' if this is fixing some issue.
-->

This PR adds integration with the `react-native-svg` (`RNSVG`) to
improve hitbox detection of the SVG elements they provide.

~~blocked~~ by
software-mansion/react-native-svg#2583
~~blocked~~ by `nested SvgViews with viewBox prop have invalid hit
detection` - No issue opened yet

## Test plan

<!--
Describe how did you test this change here.
-->

- use the newly added SVG integration example for testing this feature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants