-
public class TouchesHelperClass responsible for generating catalyst touch events based on android MotionEvent.
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringTARGET_SURFACE_KEYpublic final static StringTARGET_KEYpublic final static StringCHANGED_TOUCHES_KEYpublic final static StringTOUCHES_KEY
-
Method Summary
Modifier and Type Method Description static voidsendTouchesLegacy(RCTEventEmitter rctEventEmitter, TouchEvent touchEvent)Generate and send touch event to RCTEventEmitter JS module associated with the given {@param * context} for legacy renderer. static voidsendTouchEvent(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
-
-
-
-