Event

abstract class Event<T : Event?>

A UI event that can be dispatched to JS.

For dispatching events getEventData should be used. Once event object is passed to the EventDispatched it should no longer be used as EventDispatcher may decide to recycle that object (by calling dispose).

If you need advanced customizations and overriding only getEventData doesn't work for you, you must override both dispatch and dispatchModern. Both of these will be deleted in the distant future and it is highly recommended to use only getEventData.

Old, pre-Fabric Events only used viewTag as the identifier, but Fabric needs surfaceId as well as viewTag. You may use UIManagerHelper.getSurfaceId on a Fabric-managed View to get the surfaceId. Fabric will work without surfaceId - making Event backwards-compatible - but Events without SurfaceId are slightly slower to propagate.

Inheritors

Types

Functions

Link copied to clipboard
open fun canCoalesce(): Boolean
Link copied to clipboard
open fun coalesce(otherEvent: T): T
Given two events, coalesce them into a single event that will be sent to JS instead of two separate events.
Link copied to clipboard
open fun dispatch(rctEventEmitter: RCTEventEmitter)
Dispatch this event to JS using the given event emitter.
Link copied to clipboard
open fun dispatchModern(rctEventEmitter: RCTModernEventEmitter)
Dispatch this event to JS using a V2 EventEmitter.
Link copied to clipboard
Link copied to clipboard
abstract fun getEventName(): String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getUniqueID(): Int
Link copied to clipboard
Link copied to clipboard
open fun onDispose()
Called when the EventDispatcher is done with an event, either because it was dispatched or because it was coalesced with another Event.