mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Support RCTModernEventEmitter+RCTEventEmitter in RefreshEvent 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: D26056815 fbshipit-source-id: d0e03a69f84de47385e064c74f0a79c52c61022d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a8d7c2cd62
commit
1dcb4cfe7f
@@ -7,13 +7,20 @@
|
||||
|
||||
package com.facebook.react.views.swiperefresh;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.uimanager.events.Event;
|
||||
import com.facebook.react.uimanager.events.RCTEventEmitter;
|
||||
|
||||
public class RefreshEvent extends Event<RefreshEvent> {
|
||||
|
||||
@Deprecated
|
||||
protected RefreshEvent(int viewTag) {
|
||||
super(viewTag);
|
||||
this(-1, viewTag);
|
||||
}
|
||||
|
||||
protected RefreshEvent(int surfaceId, int viewTag) {
|
||||
super(surfaceId, viewTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -21,8 +28,9 @@ public class RefreshEvent extends Event<RefreshEvent> {
|
||||
return "topRefresh";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public void dispatch(RCTEventEmitter rctEventEmitter) {
|
||||
rctEventEmitter.receiveEvent(getViewTag(), getEventName(), null);
|
||||
protected WritableMap getEventData() {
|
||||
return Arguments.createMap();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -146,7 +146,8 @@ public class SwipeRefreshLayoutManager extends ViewGroupManager<ReactSwipeRefres
|
||||
EventDispatcher eventDispatcher =
|
||||
UIManagerHelper.getEventDispatcherForReactTag(reactContext, view.getId());
|
||||
if (eventDispatcher != null) {
|
||||
eventDispatcher.dispatchEvent(new RefreshEvent(view.getId()));
|
||||
eventDispatcher.dispatchEvent(
|
||||
new RefreshEvent(UIManagerHelper.getSurfaceId(view), view.getId()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user