mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 03:26:07 +00:00
ShadowNodeHierarchyManager should be supplied externally to UIManagerModule
Summary: public UIManagerModule should not be creating UIImplementation. Instead, UIImplementation instance should be supplied to it to allow plugging in different implementations. No functional changes. Reviewed By: astreet Differential Revision: D2464632 fb-gh-sync-id: e7372977c93ceb7ef5e8658e5ee7e8e87f52d851
This commit is contained in:
parent
599a130c9a
commit
fd0d987768
@ -28,6 +28,7 @@ import com.facebook.react.modules.debug.SourceCodeModule;
|
||||
import com.facebook.react.modules.systeminfo.AndroidInfoModule;
|
||||
import com.facebook.react.uimanager.AppRegistry;
|
||||
import com.facebook.react.uimanager.ReactNative;
|
||||
import com.facebook.react.uimanager.UIImplementation;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
import com.facebook.react.uimanager.debug.DebugComponentOwnershipModule;
|
||||
@ -57,9 +58,12 @@ import com.facebook.systrace.Systrace;
|
||||
Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "createUIManagerModule");
|
||||
UIManagerModule uiManagerModule;
|
||||
try {
|
||||
List<ViewManager> viewManagersList = mReactInstanceManager.createAllViewManagers(
|
||||
catalystApplicationContext);
|
||||
uiManagerModule = new UIManagerModule(
|
||||
catalystApplicationContext,
|
||||
mReactInstanceManager.createAllViewManagers(catalystApplicationContext));
|
||||
viewManagersList,
|
||||
new UIImplementation(catalystApplicationContext, viewManagersList));
|
||||
} finally {
|
||||
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ package com.facebook.react.uimanager;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.facebook.csslayout.CSSLayoutContext;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
@ -39,11 +40,11 @@ public class UIImplementation {
|
||||
private final NativeViewHierarchyOptimizer mNativeViewHierarchyOptimizer;
|
||||
private final int[] mMeasureBuffer = new int[4];
|
||||
|
||||
public UIImplementation(ReactApplicationContext reactContext, ViewManagerRegistry viewManagers) {
|
||||
public UIImplementation(ReactApplicationContext reactContext, List<ViewManager> viewManagers) {
|
||||
mViewManagers = new ViewManagerRegistry(viewManagers);
|
||||
mOperationsQueue = new UIViewOperationQueue(
|
||||
reactContext,
|
||||
new NativeViewHierarchyManager(viewManagers));
|
||||
mViewManagers = viewManagers;
|
||||
new NativeViewHierarchyManager(mViewManagers));
|
||||
mNativeViewHierarchyOptimizer = new NativeViewHierarchyOptimizer(
|
||||
mOperationsQueue,
|
||||
mShadowNodeRegistry);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -78,17 +78,27 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
private int mNextRootViewTag = 1;
|
||||
private int mBatchId = 0;
|
||||
|
||||
public UIManagerModule(ReactApplicationContext reactContext, List<ViewManager> viewManagerList) {
|
||||
/**
|
||||
* This contructor is temporarily here to workaround Sandcastle error.
|
||||
*/
|
||||
public UIManagerModule(
|
||||
ReactApplicationContext reactContext,
|
||||
List<ViewManager> viewManagerList) {
|
||||
this(reactContext, viewManagerList, new UIImplementation(reactContext, viewManagerList));
|
||||
}
|
||||
|
||||
public UIManagerModule(
|
||||
ReactApplicationContext reactContext,
|
||||
List<ViewManager> viewManagerList,
|
||||
UIImplementation uiImplementation) {
|
||||
super(reactContext);
|
||||
mEventDispatcher = new EventDispatcher(reactContext);
|
||||
DisplayMetrics displayMetrics = reactContext.getResources().getDisplayMetrics();
|
||||
DisplayMetricsHolder.setDisplayMetrics(displayMetrics);
|
||||
mModuleConstants = createConstants(displayMetrics, viewManagerList);
|
||||
reactContext.addLifecycleEventListener(this);
|
||||
mUIImplementation = uiImplementation;
|
||||
|
||||
mUIImplementation = new UIImplementation(
|
||||
reactContext,
|
||||
new ViewManagerRegistry(viewManagerList));
|
||||
reactContext.addLifecycleEventListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user