Skip to content

Commit 010e001

Browse files
jakex7facebook-github-bot
authored andcommitted
Make setPointerEvents public on ReactViewGroup.java (#45975)
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
1 parent c30e35f commit 010e001

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8247,6 +8247,7 @@ public class com/facebook/react/views/view/ReactViewGroup : android/view/ViewGro
82478247
public fun setOpacityIfPossible (F)V
82488248
public fun setOverflow (Ljava/lang/String;)V
82498249
public fun setOverflowInset (IIII)V
8250+
public fun setPointerEvents (Lcom/facebook/react/uimanager/PointerEvents;)V
82508251
public fun setRemoveClippedSubviews (Z)V
82518252
public fun setTranslucentBackgroundDrawable (Landroid/graphics/drawable/Drawable;)V
82528253
public fun updateClippingRect ()V

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ protected void dispatchSetPressed(boolean pressed) {
673673
// to it's children.
674674
}
675675

676-
/*package*/ void setPointerEvents(PointerEvents pointerEvents) {
676+
public void setPointerEvents(PointerEvents pointerEvents) {
677677
mPointerEvents = pointerEvents;
678678
}
679679

0 commit comments

Comments
 (0)