Support RCTModernEventEmitter+RCTEventEmitter in TouchEvent Event class

Summary:
Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D26056725

fbshipit-source-id: 771e5dd4cd1aeca3d2afd1a67ee58b9ac21eda79
This commit is contained in:
Joshua Gross 2021-01-28 14:01:07 -08:00 коммит произвёл Facebook GitHub Bot
Родитель db5bc2f766
Коммит e253a6940d
1 изменённых файлов: 25 добавлений и 0 удалений

Просмотреть файл

@ -30,6 +30,26 @@ public class TouchEvent extends Event<TouchEvent> {
public static final long UNSET = Long.MIN_VALUE;
@Deprecated
public static TouchEvent obtain(
int viewTag,
TouchEventType touchEventType,
MotionEvent motionEventToCopy,
long gestureStartTime,
float viewX,
float viewY,
TouchEventCoalescingKeyHelper touchEventCoalescingKeyHelper) {
return obtain(
-1,
viewTag,
touchEventType,
motionEventToCopy,
gestureStartTime,
viewX,
viewY,
touchEventCoalescingKeyHelper);
}
public static TouchEvent obtain(
int surfaceId,
int viewTag,
@ -151,6 +171,11 @@ public class TouchEvent extends Event<TouchEvent> {
this);
}
@Override
public void dispatchModern(RCTModernEventEmitter rctEventEmitter) {
dispatch(rctEventEmitter);
}
public MotionEvent getMotionEvent() {
Assertions.assertNotNull(mMotionEvent);
return mMotionEvent;