Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: make RenderableView.hitTest public to create a cross-library interface #2555

Merged
merged 1 commit into from
Nov 28, 2024

Conversation

latekvo
Copy link
Contributor

@latekvo latekvo commented Nov 28, 2024

Summary

Adding an RNGH <-> RNSVG interface requires usage of RenderableView.hitTest to work. (link)
Currently, RenderableView.hitTest is package-private, meaning it cannot be accessed by other packages.
This change does not change any functionality of the library, it only exposes existing functions to other libraries.

I only made public those hitTest implementation which are strictly necessary for this interface, this is why multiple, if not most hitTest implementations remain package-private despite the changes made in the PR.

Test Plan

  • open the example app, see how the app builds successfully

What's required for testing (prerequisites)?

  • RNSVG's paper-example app

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

@latekvo latekvo marked this pull request as ready for review November 28, 2024 14:50
@jakex7 jakex7 changed the title Make RenderableView.hitTest public to create a cross-library interface feat: make RenderableView.hitTest public to create a cross-library interface Nov 28, 2024
@jakex7 jakex7 merged commit 01db444 into software-mansion:main Nov 28, 2024
3 of 4 checks passed
latekvo added a commit that referenced this pull request Dec 19, 2024
@latekvo latekvo mentioned this pull request Dec 19, 2024
4 tasks
jakex7 pushed a commit that referenced this pull request Jan 15, 2025
<!-- Thanks for submitting a pull request! We appreciate you spending
the time to work on these changes. Please follow the template so that
the reviewers can easily understand what the code changes affect -->

# 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
`VirtualView`s, 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](software-mansion/react-native-gesture-handler#3242).

## Test Plan

Run the example from the RNGH - RNSVG [integration
PR](software-mansion/react-native-gesture-handler#3242).

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| Android |    ✅      |
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants