mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-06 07:06:11 +00:00
feat: make svgView getter public (#2583)
<!-- 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](https://github.com/software-mansion/react-native-gesture-handler/pull/3242/). ## Test Plan Run the example from the RNGH - RNSVG [integration PR](https://github.com/software-mansion/react-native-gesture-handler/pull/3242/). ## Compatibility | OS | Implemented | | ------- | :---------: | | Android | ✅ |
This commit is contained in:
@@ -40,7 +40,7 @@ class ClipPathView extends GroupView {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hitTest(float[] src) {
|
||||
int hitTest(float[] src) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ class GroupView extends RenderableView {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hitTest(final float[] src) {
|
||||
int hitTest(final float[] src) {
|
||||
if (!mInvertible) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -676,7 +676,7 @@ public abstract class RenderableView extends VirtualView implements ReactHitSlop
|
||||
abstract Path getPath(Canvas canvas, Paint paint);
|
||||
|
||||
@Override
|
||||
public int hitTest(final float[] src) {
|
||||
int hitTest(final float[] src) {
|
||||
if (mPath == null || !mInvertible) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1208,7 +1208,7 @@ class TSpanView extends TextView {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hitTest(final float[] src) {
|
||||
int hitTest(final float[] src) {
|
||||
if (mContent == null) {
|
||||
return super.hitTest(src);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ class UseView extends RenderableView {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hitTest(float[] src) {
|
||||
int hitTest(float[] src) {
|
||||
if (!mInvertible) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ public abstract class VirtualView extends ReactViewGroup {
|
||||
abstract Path getPath(Canvas canvas, Paint paint);
|
||||
|
||||
@Nullable
|
||||
SvgView getSvgView() {
|
||||
public SvgView getSvgView() {
|
||||
if (svgView != null) {
|
||||
return svgView;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user