-
public class TouchEvent extends Event<TouchEvent>
An event representing the start, end or movement of a touch. Corresponds to a single .
TouchEvent coalescing can happen for move events if two move events have the same target view and coalescing key. See TouchEventCoalescingKeyHelper for more information about how these coalescing keys are determined.
-
-
Field Summary
Fields Modifier and Type Field Description public final static long
UNSET
-
Method Summary
Modifier and Type Method Description static TouchEvent
obtain(int viewTag, TouchEventType touchEventType, MotionEvent motionEventToCopy, long gestureStartTime, float viewX, float viewY, TouchEventCoalescingKeyHelper touchEventCoalescingKeyHelper)
static TouchEvent
obtain(int surfaceId, int viewTag, TouchEventType touchEventType, MotionEvent motionEventToCopy, long gestureStartTime, float viewX, float viewY, TouchEventCoalescingKeyHelper touchEventCoalescingKeyHelper)
void
onDispose()
Called when the EventDispatcher is done with an event, either because it was dispatched orbecause it was coalesced with another Event. String
getEventName()
boolean
canCoalesce()
short
getCoalescingKey()
void
dispatch(RCTEventEmitter rctEventEmitter)
Dispatch this event to JS using the given event emitter. void
dispatchModern(RCTModernEventEmitter rctEventEmitter)
Dispatch this event to JS using a V2 EventEmitter. MotionEvent
getMotionEvent()
TouchEventType
getTouchEventType()
float
getViewX()
float
getViewY()
-
-
Method Detail
-
obtain
@Deprecated() static TouchEvent obtain(int viewTag, TouchEventType touchEventType, MotionEvent motionEventToCopy, long gestureStartTime, float viewX, float viewY, TouchEventCoalescingKeyHelper touchEventCoalescingKeyHelper)
-
obtain
static TouchEvent obtain(int surfaceId, int viewTag, TouchEventType touchEventType, MotionEvent motionEventToCopy, long gestureStartTime, float viewX, float viewY, TouchEventCoalescingKeyHelper touchEventCoalescingKeyHelper)
-
onDispose
void onDispose()
Called when the EventDispatcher is done with an event, either because it was dispatched orbecause it was coalesced with another Event.
-
getEventName
String getEventName()
-
canCoalesce
boolean canCoalesce()
-
getCoalescingKey
short getCoalescingKey()
-
dispatch
void dispatch(RCTEventEmitter rctEventEmitter)
Dispatch this event to JS using the given event emitter. Compatible with old and new renderer.Instead of using this or dispatchModern, it is recommended that you simply override`getEventData`.
-
dispatchModern
void dispatchModern(RCTModernEventEmitter rctEventEmitter)
Dispatch this event to JS using a V2 EventEmitter. If surfaceId is not -1 and `getEventData` isnon-null, this will use the RCTModernEventEmitter API. Otherwise, it falls back to theold-style dispatch function. For Event classes that need to do something different, this methodcan always be overridden entirely, but it is not recommended.
This method additionally allows C++ to coalesce events and detect continuous ones forconcurrent mode (Fabric only).
-
getMotionEvent
MotionEvent getMotionEvent()
-
getTouchEventType
TouchEventType getTouchEventType()
-
getViewX
float getViewX()
-
getViewY
float getViewY()
-
-
-
-