From e69f0726cd2616fb112d2e4fabfeaafc8cada5d7 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Mon, 23 Jun 2025 07:35:06 -0700 Subject: [PATCH] Make `EventDispatcherImpl` internal (#52154) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52154 I wasn't able to find any meaningful usage of `EventDispatcherImpl` in OSS, therefore I'm making this class internal. Changelog: [Internal] [Changed] - Reviewed By: javache Differential Revision: D77024759 fbshipit-source-id: e1ff3329cedf96a8c75edb9b9ccc1ce21adfab11 --- .../ReactAndroid/api/ReactAndroid.api | 18 ------------------ .../uimanager/events/EventDispatcherImpl.kt | 4 ++-- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index 38e82384e64..b8fc80043ce 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -4866,24 +4866,6 @@ public abstract interface class com/facebook/react/uimanager/events/EventDispatc public abstract fun removeListener (Lcom/facebook/react/uimanager/events/EventDispatcherListener;)V } -public final class com/facebook/react/uimanager/events/EventDispatcherImpl : com/facebook/react/bridge/LifecycleEventListener, com/facebook/react/uimanager/events/EventDispatcher { - public static final field Companion Lcom/facebook/react/uimanager/events/EventDispatcherImpl$Companion; - public fun (Lcom/facebook/react/bridge/ReactApplicationContext;)V - public fun addBatchEventDispatchedListener (Lcom/facebook/react/uimanager/events/BatchEventDispatchedListener;)V - public fun addListener (Lcom/facebook/react/uimanager/events/EventDispatcherListener;)V - public fun dispatchAllEvents ()V - public fun dispatchEvent (Lcom/facebook/react/uimanager/events/Event;)V - public fun onCatalystInstanceDestroyed ()V - public fun onHostDestroy ()V - public fun onHostPause ()V - public fun onHostResume ()V - public fun removeBatchEventDispatchedListener (Lcom/facebook/react/uimanager/events/BatchEventDispatchedListener;)V - public fun removeListener (Lcom/facebook/react/uimanager/events/EventDispatcherListener;)V -} - -public final class com/facebook/react/uimanager/events/EventDispatcherImpl$Companion { -} - public abstract interface class com/facebook/react/uimanager/events/EventDispatcherListener { public abstract fun onEventDispatch (Lcom/facebook/react/uimanager/events/Event;)V } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcherImpl.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcherImpl.kt index 3e156bfa8cf..bd033022f77 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcherImpl.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcherImpl.kt @@ -51,7 +51,7 @@ import java.util.concurrent.atomic.AtomicInteger * 0x0000ffff00000000 COALESCING_KEY_MASK = 0xffff000000000000 */ @InteropLegacyArchitecture -public class EventDispatcherImpl(private val reactContext: ReactApplicationContext) : +internal class EventDispatcherImpl(private val reactContext: ReactApplicationContext) : EventDispatcher, LifecycleEventListener { private val eventsStagingLock = Any() private val eventsToDispatchLock = Any() @@ -308,7 +308,7 @@ public class EventDispatcherImpl(private val reactContext: ReactApplicationConte eventsToDispatchSize = 0 } - public companion object { + companion object { private val EVENT_COMPARATOR: java.util.Comparator?> = java.util.Comparator { lhs, rhs -> when {