Fabric FB4A integration
Reviewed By: fkgozali Differential Revision: D7953706 fbshipit-source-id: 406f8340eb3706dc07dcd32dcfaa5bdc06981aa1
This commit is contained in:
parent
4767f9be45
commit
dbc9364b21
|
@ -262,7 +262,7 @@ public class ReactAppTestActivity extends FragmentActivity
|
|||
@Override
|
||||
public FabricUIManager getJSIModule() {
|
||||
List<ViewManager> viewManagers =
|
||||
getReactInstanceManager().getOrCreateViewManagers(reactApplicationContext);
|
||||
getReactInstanceManager().getOrCreateViewManagers(reactApplicationContext);
|
||||
FabricUIManager fabricUIManager =
|
||||
new FabricUIManager(
|
||||
reactApplicationContext, new ViewManagerRegistry(viewManagers));
|
||||
|
|
|
@ -85,7 +85,6 @@ import com.facebook.react.views.imagehelper.ResourceDrawableIdHelper;
|
|||
import com.facebook.soloader.SoLoader;
|
||||
import com.facebook.systrace.Systrace;
|
||||
import com.facebook.systrace.SystraceMessage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
|
|
@ -281,6 +281,6 @@ public class ReactInstanceManagerBuilder {
|
|||
mDevBundleDownloadListener,
|
||||
mMinNumShakes,
|
||||
mMinTimeLeftInFrameForNonBatchedOperationMs,
|
||||
mJSIModulesProvider);
|
||||
mJSIModulesProvider);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,37 @@
|
|||
package com.facebook.react.bridge;
|
||||
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
|
||||
public class JSIModuleRegistry {
|
||||
|
||||
private final List<JSIModuleHolder> mModuleList = new ArrayList<>();
|
||||
private final Map<Class, JSIModule> mModules = new HashMap<>();
|
||||
private volatile boolean mIsInitialized = false;
|
||||
|
||||
public JSIModuleRegistry() { }
|
||||
|
||||
public <T extends JSIModule> T getModule(Class<T> moduleClass) {
|
||||
JSIModule jsiModule = mModules.get(moduleClass);
|
||||
if (jsiModule == null) {
|
||||
initModules();
|
||||
}
|
||||
return (T) Assertions.assertNotNull(mModules.get(moduleClass));
|
||||
}
|
||||
|
||||
public void registerModules(List<JSIModuleHolder> jsiModules) {
|
||||
for (JSIModuleHolder holder : jsiModules) {
|
||||
mModules.put(holder.getJSIModuleClass(), holder.getJSIModule());
|
||||
mModuleList.addAll(jsiModules);
|
||||
}
|
||||
|
||||
public synchronized void initModules() {
|
||||
if (!mIsInitialized) {
|
||||
for (JSIModuleHolder holder : mModuleList) {
|
||||
mModules.put(holder.getJSIModuleClass(), holder.getJSIModule());
|
||||
}
|
||||
mIsInitialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue