diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index 726557ab23d..5cb95aee59d 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -4253,14 +4253,21 @@ public final class com/facebook/react/uimanager/PointerEvents : java/lang/Enum { public static final field AUTO Lcom/facebook/react/uimanager/PointerEvents; public static final field BOX_NONE Lcom/facebook/react/uimanager/PointerEvents; public static final field BOX_ONLY Lcom/facebook/react/uimanager/PointerEvents; + public static final field Companion Lcom/facebook/react/uimanager/PointerEvents$Companion; public static final field NONE Lcom/facebook/react/uimanager/PointerEvents; - public static fun canBeTouchTarget (Lcom/facebook/react/uimanager/PointerEvents;)Z - public static fun canChildrenBeTouchTarget (Lcom/facebook/react/uimanager/PointerEvents;)Z - public static fun parsePointerEvents (Ljava/lang/String;)Lcom/facebook/react/uimanager/PointerEvents; + public static final fun canBeTouchTarget (Lcom/facebook/react/uimanager/PointerEvents;)Z + public static final fun canChildrenBeTouchTarget (Lcom/facebook/react/uimanager/PointerEvents;)Z + public static final fun parsePointerEvents (Ljava/lang/String;)Lcom/facebook/react/uimanager/PointerEvents; public static fun valueOf (Ljava/lang/String;)Lcom/facebook/react/uimanager/PointerEvents; public static fun values ()[Lcom/facebook/react/uimanager/PointerEvents; } +public final class com/facebook/react/uimanager/PointerEvents$Companion { + public final fun canBeTouchTarget (Lcom/facebook/react/uimanager/PointerEvents;)Z + public final fun canChildrenBeTouchTarget (Lcom/facebook/react/uimanager/PointerEvents;)Z + public final fun parsePointerEvents (Ljava/lang/String;)Lcom/facebook/react/uimanager/PointerEvents; +} + public class com/facebook/react/uimanager/ReactAccessibilityDelegate : androidx/customview/widget/ExploreByTouchHelper { public static final field TOP_ACCESSIBILITY_ACTION_EVENT Ljava/lang/String; public static final field sActionIdMap Ljava/util/HashMap; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/PointerEvents.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/PointerEvents.java deleted file mode 100644 index 207a650d0db..00000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/PointerEvents.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.uimanager; - -import com.facebook.infer.annotation.Nullsafe; -import java.util.Locale; - -/** - * Possible values for pointer events that a view and its descendants should receive. See - * https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events for more info. - */ -@Nullsafe(Nullsafe.Mode.LOCAL) -public enum PointerEvents { - - /** Neither the container nor its children receive events. */ - NONE, - - /** Container doesn't get events but all of its children do. */ - BOX_NONE, - - /** Container gets events but none of its children do. */ - BOX_ONLY, - - /** Container and all of its children receive touch events (like pointerEvents is unspecified). */ - AUTO, - ; - - public static PointerEvents parsePointerEvents(String pointerEventsStr) { - if (pointerEventsStr == null) { - return PointerEvents.AUTO; - } else { - return PointerEvents.valueOf(pointerEventsStr.toUpperCase(Locale.US).replace("-", "_")); - } - } - - public static boolean canBeTouchTarget(PointerEvents pointerEvents) { - return pointerEvents == AUTO || pointerEvents == PointerEvents.BOX_ONLY; - } - - public static boolean canChildrenBeTouchTarget(PointerEvents pointerEvents) { - return pointerEvents == PointerEvents.AUTO || pointerEvents == PointerEvents.BOX_NONE; - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/PointerEvents.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/PointerEvents.kt new file mode 100644 index 00000000000..59b76c21e38 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/PointerEvents.kt @@ -0,0 +1,50 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.uimanager + +import java.util.Locale + +/** + * Possible values for pointer events that a view and its descendants should receive. See + * https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events for more info. + */ +public enum class PointerEvents { + /** Neither the container nor its children receive events. */ + NONE, + + /** Container doesn't get events but all of its children do. */ + BOX_NONE, + + /** Container gets events but none of its children do. */ + BOX_ONLY, + + /** Container and all of its children receive touch events (like pointerEvents is unspecified). */ + AUTO; + + public companion object { + + @JvmStatic + public fun parsePointerEvents(pointerEventsStr: String?): PointerEvents { + if (pointerEventsStr == null) { + return AUTO + } else { + return PointerEvents.valueOf(pointerEventsStr.uppercase(Locale.US).replace("-", "_")) + } + } + + @JvmStatic + public fun canBeTouchTarget(pointerEvents: PointerEvents): Boolean { + return pointerEvents == AUTO || pointerEvents == BOX_ONLY + } + + @JvmStatic + public fun canChildrenBeTouchTarget(pointerEvents: PointerEvents): Boolean { + return pointerEvents == AUTO || pointerEvents == BOX_NONE + } + } +}