diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcher.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcher.java deleted file mode 100644 index 056d671143cbe9..00000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcher.java +++ /dev/null @@ -1,37 +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.events; - -import com.facebook.react.uimanager.common.UIManagerType; - -public interface EventDispatcher { - - /** Sends the given Event to JS, coalescing eligible events if JS is backed up. */ - void dispatchEvent(Event event); - - void dispatchAllEvents(); - - /** Add a listener to this EventDispatcher. */ - void addListener(EventDispatcherListener listener); - - /** Remove a listener from this EventDispatcher. */ - void removeListener(EventDispatcherListener listener); - - void addBatchEventDispatchedListener(BatchEventDispatchedListener listener); - - void removeBatchEventDispatchedListener(BatchEventDispatchedListener listener); - - @Deprecated - void registerEventEmitter(@UIManagerType int uiManagerType, RCTEventEmitter eventEmitter); - - void registerEventEmitter(@UIManagerType int uiManagerType, RCTModernEventEmitter eventEmitter); - - void unregisterEventEmitter(@UIManagerType int uiManagerType); - - void onCatalystInstanceDestroyed(); -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcher.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcher.kt new file mode 100644 index 00000000000000..cbb7b623374237 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcher.kt @@ -0,0 +1,40 @@ +/* + * 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.events + +import com.facebook.react.uimanager.common.UIManagerType + +public interface EventDispatcher { + /** Sends the given Event to JS, coalescing eligible events if JS is backed up. */ + public fun dispatchEvent(event: Event<*>) + + public fun dispatchAllEvents() + + /** Add a listener to this EventDispatcher. */ + public fun addListener(listener: EventDispatcherListener) + + /** Remove a listener from this EventDispatcher. */ + public fun removeListener(listener: EventDispatcherListener) + + public fun addBatchEventDispatchedListener(listener: BatchEventDispatchedListener) + + public fun removeBatchEventDispatchedListener(listener: BatchEventDispatchedListener) + + @Deprecated("Use the modern version with RCTModernEventEmitter") + @Suppress("DEPRECATION") + public fun registerEventEmitter(@UIManagerType uiManagerType: Int, eventEmitter: RCTEventEmitter) + + public fun registerEventEmitter( + @UIManagerType uiManagerType: Int, + eventEmitter: RCTModernEventEmitter + ) + + public fun unregisterEventEmitter(@UIManagerType uiManagerType: Int) + + public fun onCatalystInstanceDestroyed() +}