-
public class TouchesHelper
Class responsible for generating catalyst touch events based on android MotionEvent.
-
-
Field Summary
Fields Modifier and Type Field Description public final static String
TARGET_SURFACE_KEY
public final static String
TARGET_KEY
public final static String
CHANGED_TOUCHES_KEY
public final static String
TOUCHES_KEY
-
Method Summary
Modifier and Type Method Description static void
sendTouchesLegacy(RCTEventEmitter rctEventEmitter, TouchEvent touchEvent)
Generate and send touch event to RCTEventEmitter JS module associated with the given {@param * context} for legacy renderer. static void
sendTouchEvent(RCTModernEventEmitter eventEmitter, TouchEvent event)
Generate touch event data to match JS expectations. -
-
Method Detail
-
sendTouchesLegacy
static void sendTouchesLegacy(RCTEventEmitter rctEventEmitter, TouchEvent touchEvent)
Generate and send touch event to RCTEventEmitter JS module associated with the given {@param * context} for legacy renderer. Touch event can encode multiple concurrent touches (pointers).
- Parameters:
rctEventEmitter
- Event emitter used to execute JS module calltouchEvent
- native touch event to read pointers count and coordinates from
-
sendTouchEvent
static void sendTouchEvent(RCTModernEventEmitter eventEmitter, TouchEvent event)
Generate touch event data to match JS expectations. Combines logic in sendTouchEvent and FabricEventEmitter to create the same data structure in a more efficient manner.
Touches have to be dispatched as separate events for each changed pointer to make JS processthem correctly. To avoid allocations, we preprocess touch events in Java world and then convertthem to native before dispatch.
- Parameters:
eventEmitter
- emitter to dispatch event toevent
- the touch event to extract data from
-
-
-
-