Make PointerEvent internal (#52131)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52131

This class is not used in OSS and can be made internal.

Changelog:
[Internal] [Changed] -

Reviewed By: javache

Differential Revision: D76979122

fbshipit-source-id: 2d81e3605e6c51336b3bdb2671dd9faf8f25639b
This commit is contained in:
Nicola Corti
2025-06-19 09:59:27 -07:00
committed by Facebook GitHub Bot
parent 0cf2985d27
commit 55b87a5293
2 changed files with 16 additions and 49 deletions
@@ -4890,38 +4890,6 @@ public final class com/facebook/react/uimanager/events/NativeGestureUtil {
public static final fun notifyNativeGestureStarted (Landroid/view/View;Landroid/view/MotionEvent;)V
}
public final class com/facebook/react/uimanager/events/PointerEvent : com/facebook/react/uimanager/events/Event {
public static final field Companion Lcom/facebook/react/uimanager/events/PointerEvent$Companion;
public fun dispatch (Lcom/facebook/react/uimanager/events/RCTEventEmitter;)V
public fun dispatchModern (Lcom/facebook/react/uimanager/events/RCTModernEventEmitter;)V
public fun getCoalescingKey ()S
public fun getEventAnimationDriverMatchSpec ()Lcom/facebook/react/uimanager/events/Event$EventAnimationDriverMatchSpec;
public fun getEventName ()Ljava/lang/String;
public static final fun obtain (Ljava/lang/String;ILcom/facebook/react/uimanager/events/PointerEvent$PointerEventState;Landroid/view/MotionEvent;)Lcom/facebook/react/uimanager/events/PointerEvent;
public static final fun obtain (Ljava/lang/String;ILcom/facebook/react/uimanager/events/PointerEvent$PointerEventState;Landroid/view/MotionEvent;S)Lcom/facebook/react/uimanager/events/PointerEvent;
public fun onDispose ()V
}
public final class com/facebook/react/uimanager/events/PointerEvent$Companion {
public final fun obtain (Ljava/lang/String;ILcom/facebook/react/uimanager/events/PointerEvent$PointerEventState;Landroid/view/MotionEvent;)Lcom/facebook/react/uimanager/events/PointerEvent;
public final fun obtain (Ljava/lang/String;ILcom/facebook/react/uimanager/events/PointerEvent$PointerEventState;Landroid/view/MotionEvent;S)Lcom/facebook/react/uimanager/events/PointerEvent;
}
public final class com/facebook/react/uimanager/events/PointerEvent$PointerEventState {
public fun <init> (IIIILjava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Set;)V
public final fun getActivePointerId ()I
public final fun getEventCoordinatesByPointerId ()Ljava/util/Map;
public final fun getHitPathByPointerId ()Ljava/util/Map;
public final fun getHitPathForActivePointer ()Ljava/util/List;
public final fun getHoveringPointerIds ()Ljava/util/Set;
public final fun getLastButtonState ()I
public final fun getOffsetByPointerId ()Ljava/util/Map;
public final fun getPrimaryPointerId ()I
public final fun getScreenCoordinatesByPointerId ()Ljava/util/Map;
public final fun getSurfaceId ()I
public final fun supportsHover (I)Z
}
public abstract interface class com/facebook/react/uimanager/events/RCTEventEmitter : com/facebook/react/bridge/JavaScriptModule {
public abstract fun receiveEvent (ILjava/lang/String;Lcom/facebook/react/bridge/WritableMap;)V
public abstract fun receiveTouches (Ljava/lang/String;Lcom/facebook/react/bridge/WritableArray;Lcom/facebook/react/bridge/WritableArray;)V
@@ -24,7 +24,7 @@ import com.facebook.react.uimanager.events.PointerEventHelper.getPressure
import com.facebook.react.uimanager.events.PointerEventHelper.getW3CPointerType
import com.facebook.react.uimanager.events.PointerEventHelper.isBubblingEvent
public class PointerEvent private constructor() : Event<PointerEvent>() {
internal class PointerEvent private constructor() : Event<PointerEvent>() {
private var motionEvent: MotionEvent? = null
private lateinit var _eventName: String
private var coalescingKey = UNSET_COALESCING_KEY
@@ -269,36 +269,35 @@ public class PointerEvent private constructor() : Event<PointerEvent>() {
}
}
public class PointerEventState
public constructor(
public val primaryPointerId: Int,
public val activePointerId: Int,
public val lastButtonState: Int,
class PointerEventState(
val primaryPointerId: Int,
val activePointerId: Int,
val lastButtonState: Int,
private val surfaceId: Int,
public val offsetByPointerId: Map<Int, FloatArray>,
public val hitPathByPointerId: Map<Int, List<ViewTarget>>,
public val eventCoordinatesByPointerId: Map<Int, FloatArray>,
public val screenCoordinatesByPointerId: Map<Int, FloatArray>,
val offsetByPointerId: Map<Int, FloatArray>,
val hitPathByPointerId: Map<Int, List<ViewTarget>>,
val eventCoordinatesByPointerId: Map<Int, FloatArray>,
val screenCoordinatesByPointerId: Map<Int, FloatArray>,
hoveringPointerIds: Set<Int>
) {
public val hoveringPointerIds: Set<Int> = HashSet(hoveringPointerIds)
val hoveringPointerIds: Set<Int> = HashSet(hoveringPointerIds)
public fun getSurfaceId(): Int = surfaceId
fun getSurfaceId(): Int = surfaceId
public fun supportsHover(pointerId: Int): Boolean = hoveringPointerIds.contains(pointerId)
fun supportsHover(pointerId: Int): Boolean = hoveringPointerIds.contains(pointerId)
public val hitPathForActivePointer: List<ViewTarget>
val hitPathForActivePointer: List<ViewTarget>
get() = checkNotNull(hitPathByPointerId[activePointerId])
}
public companion object {
companion object {
private val TAG: String = PointerEvent::class.java.simpleName
private const val POINTER_EVENTS_POOL_SIZE = 6
private val EVENTS_POOL = SynchronizedPool<PointerEvent>(POINTER_EVENTS_POOL_SIZE)
private const val UNSET_COALESCING_KEY: Short = -1
@JvmStatic
public fun obtain(
fun obtain(
eventName: String,
targetTag: Int,
eventState: PointerEventState,
@@ -318,7 +317,7 @@ public class PointerEvent private constructor() : Event<PointerEvent>() {
}
@JvmStatic
public fun obtain(
fun obtain(
eventName: String,
targetTag: Int,
eventState: PointerEventState,