mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Use UIManagerHelper to access EventDispatcher in ReactViewManager
Summary: ReactViewManager uses the bridge (CatalystInstance) to access the UIManagerModule in its onClick method. This doesn't work in bridgeless mode, so I'm replacing this callsite with the new API, which uses UIManagerHelper + the reactTag to look up the appropriate UIManager (Paper or Fabric), and get the EventDispatcher from that. Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D21510243 fbshipit-source-id: c2c6111e73c49ca6bf873819db8ece71c66417e4
This commit is contained in:
committed by
Facebook GitHub Bot
parent
dba588741c
commit
6c4224ea9b
@@ -24,7 +24,7 @@ import com.facebook.react.uimanager.PixelUtil;
|
||||
import com.facebook.react.uimanager.PointerEvents;
|
||||
import com.facebook.react.uimanager.Spacing;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.UIManagerHelper;
|
||||
import com.facebook.react.uimanager.ViewProps;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.annotations.ReactPropGroup;
|
||||
@@ -233,14 +233,12 @@ public class ReactViewManager extends ReactClippingViewManager<ReactViewGroup> {
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
UIManagerModule uiManager =
|
||||
((ReactContext) view.getContext()).getNativeModule(UIManagerModule.class);
|
||||
|
||||
if (uiManager == null) {
|
||||
final EventDispatcher mEventDispatcher =
|
||||
UIManagerHelper.getEventDispatcherForReactTag(
|
||||
(ReactContext) view.getContext(), view.getId());
|
||||
if (mEventDispatcher == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final EventDispatcher mEventDispatcher = uiManager.getEventDispatcher();
|
||||
mEventDispatcher.dispatchEvent(new ViewGroupClickEvent(view.getId()));
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user