Implement FabricUIManagerModule in Android

Reviewed By: achen1

Differential Revision: D7031902

fbshipit-source-id: a8d9d505f981ac4268760efa32f4cbc7955aec32
This commit is contained in:
David Vacca
2018-02-21 09:21:34 -08:00
committed by Facebook Github Bot
parent 47addd8e34
commit 4371d1e1d0
6 changed files with 75 additions and 24 deletions

View File

@@ -156,6 +156,7 @@ public class ReactInstanceManager {
private final boolean mLazyNativeModulesEnabled;
private final boolean mDelayViewManagerClassLoadsEnabled;
private final @Nullable BridgeListener mBridgeListener;
private List<ViewManager> mViewManagers;
private class ReactContextInitParams {
private final JavaScriptExecutorFactory mJsExecutorFactory;
@@ -774,18 +775,23 @@ public class ReactInstanceManager {
/**
* Uses configured {@link ReactPackage} instances to create all view managers.
*/
public List<ViewManager> createAllViewManagers(
public List<ViewManager> getOrCreateViewManagers(
ReactApplicationContext catalystApplicationContext) {
ReactMarker.logMarker(CREATE_VIEW_MANAGERS_START);
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "createAllViewManagers");
try {
synchronized (mPackages) {
List<ViewManager> allViewManagers = new ArrayList<>();
for (ReactPackage reactPackage : mPackages) {
allViewManagers.addAll(reactPackage.createViewManagers(catalystApplicationContext));
if (mViewManagers == null) {
synchronized (mPackages) {
if (mViewManagers == null) {
mViewManagers = new ArrayList<>();
for (ReactPackage reactPackage : mPackages) {
mViewManagers.addAll(reactPackage.createViewManagers(catalystApplicationContext));
}
return mViewManagers;
}
}
return allViewManagers;
}
return mViewManagers;
} finally {
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
ReactMarker.logMarker(CREATE_VIEW_MANAGERS_END);