|
8 | 8 | package com.facebook.react.fabric;
|
9 | 9 |
|
10 | 10 | import androidx.annotation.NonNull;
|
11 |
| -import com.facebook.infer.annotation.Assertions; |
12 | 11 | import com.facebook.react.bridge.JSIModuleProvider;
|
13 | 12 | import com.facebook.react.bridge.ReactApplicationContext;
|
14 | 13 | import com.facebook.react.bridge.UIManager;
|
|
26 | 25 | import com.facebook.react.fabric.mounting.mountitems.PreAllocateViewMountItem;
|
27 | 26 | import com.facebook.react.fabric.mounting.mountitems.SendAccessibilityEvent;
|
28 | 27 | import com.facebook.react.uimanager.StateWrapper;
|
29 |
| -import com.facebook.react.uimanager.UIManagerModule; |
| 28 | +import com.facebook.react.uimanager.ViewManagerRegistry; |
30 | 29 | import com.facebook.react.uimanager.events.BatchEventDispatchedListener;
|
31 | 30 | import com.facebook.react.uimanager.events.EventDispatcher;
|
| 31 | +import com.facebook.react.uimanager.events.EventDispatcherImpl; |
32 | 32 | import com.facebook.systrace.Systrace;
|
33 | 33 |
|
34 | 34 | public class FabricJSIModuleProvider implements JSIModuleProvider<UIManager> {
|
35 | 35 |
|
36 | 36 | @NonNull private final ReactApplicationContext mReactApplicationContext;
|
37 | 37 | @NonNull private final ComponentFactory mComponentFactory;
|
38 | 38 | @NonNull private final ReactNativeConfig mConfig;
|
| 39 | + @NonNull private final ViewManagerRegistry mViewManagerRegistry; |
39 | 40 |
|
40 | 41 | public FabricJSIModuleProvider(
|
41 | 42 | @NonNull ReactApplicationContext reactApplicationContext,
|
42 | 43 | @NonNull ComponentFactory componentFactory,
|
43 |
| - @NonNull ReactNativeConfig config) { |
| 44 | + @NonNull ReactNativeConfig config, |
| 45 | + @NonNull ViewManagerRegistry viewManagerRegistry) { |
44 | 46 | mReactApplicationContext = reactApplicationContext;
|
45 | 47 | mComponentFactory = componentFactory;
|
46 | 48 | mConfig = config;
|
| 49 | + mViewManagerRegistry = viewManagerRegistry; |
47 | 50 | }
|
48 | 51 |
|
49 | 52 | @Override
|
@@ -79,15 +82,10 @@ public UIManager get() {
|
79 | 82 | private FabricUIManager createUIManager(@NonNull EventBeatManager eventBeatManager) {
|
80 | 83 | Systrace.beginSection(
|
81 | 84 | Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "FabricJSIModuleProvider.createUIManager");
|
82 |
| - UIManagerModule nativeModule = |
83 |
| - Assertions.assertNotNull(mReactApplicationContext.getNativeModule(UIManagerModule.class)); |
84 |
| - EventDispatcher eventDispatcher = nativeModule.getEventDispatcher(); |
| 85 | + EventDispatcher eventDispatcher = new EventDispatcherImpl(mReactApplicationContext); |
85 | 86 | FabricUIManager fabricUIManager =
|
86 | 87 | new FabricUIManager(
|
87 |
| - mReactApplicationContext, |
88 |
| - nativeModule.getViewManagerRegistry_DO_NOT_USE(), |
89 |
| - eventDispatcher, |
90 |
| - eventBeatManager); |
| 88 | + mReactApplicationContext, mViewManagerRegistry, eventDispatcher, eventBeatManager); |
91 | 89 |
|
92 | 90 | Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
93 | 91 | return fabricUIManager;
|
|
0 commit comments