Skip to content

feat: make svgView getter public#2583

Merged
jakex7 merged 3 commits intomainfrom
@latekvo/make-svg-view-getter-public
Jan 15, 2025
Merged

feat: make svgView getter public#2583
jakex7 merged 3 commits intomainfrom
@latekvo/make-svg-view-getter-public

Conversation

@latekvo
Copy link
Copy Markdown
Member

@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
Copy Markdown
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
@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