mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Expose receiveEvent as a high level API on UIManager
Summary: This diff exposes receiveEvent on the UIManager class. This is necessary to support backward compatibility between Fabric and classic RN changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D21979687 fbshipit-source-id: 1ec75896687d55e699f79c520e21f05fac368ee6
This commit is contained in:
committed by
Facebook GitHub Bot
parent
92630856c6
commit
a0baba654e
@@ -113,4 +113,14 @@ public interface UIManager extends JSIModule, PerformanceCounter {
|
||||
* @param listener
|
||||
*/
|
||||
void removeUIManagerEventListener(UIManagerListener listener);
|
||||
|
||||
/**
|
||||
* This method dispatches events from RN Android code to JS. The delivery of this event will not
|
||||
* be queued in EventDispatcher class.
|
||||
*
|
||||
* @param reactTag tag
|
||||
* @param eventName name of the event
|
||||
* @param event parameters
|
||||
*/
|
||||
void receiveEvent(int reactTag, String eventName, @Nullable WritableMap event);
|
||||
}
|
||||
|
||||
@@ -946,6 +946,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
|
||||
doLeftAndRightSwapInRTL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveEvent(int reactTag, String eventName, @Nullable WritableMap params) {
|
||||
EventEmitterWrapper eventEmitter = mMountingManager.getEventEmitter(reactTag);
|
||||
if (eventEmitter == null) {
|
||||
|
||||
@@ -950,4 +950,11 @@ public class UIManagerModule extends ReactContextBaseJavaModule
|
||||
.getNativeViewHierarchyManager()
|
||||
.resolveView(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveEvent(int targetTag, String eventName, @Nullable WritableMap event) {
|
||||
getReactApplicationContext()
|
||||
.getJSModule(RCTEventEmitter.class)
|
||||
.receiveEvent(targetTag, eventName, event);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user