mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-03 22:48:25 +08:00
Eagerly create FBMarketplaceNativeModule [2/N]
Summary: The full idea for eagerly creating Native Modules is articulated here https://fb.quip.com/vWcLAup3a6kR TLDR: 1) Move lazy native module work from the mqt_js thread to the background thread which processes packages. This also moves it from post-network to pre-network. 2) For a quick test, decide which modules to eagerly create with a QE flag. 3) Eagerly create the modules by opting-out of the ReactModuleInfo pipeline which was built for lazy native modules. Reviewed By: achen1 Differential Revision: D9503934 fbshipit-source-id: 0cd8337ad294cd0f8be692fecbf4292d204f3ec4
This commit is contained in:
committed by
Facebook Github Bot
parent
e8c7cb1c04
commit
58409be6b4
@@ -45,6 +45,7 @@ public class NativeModuleRegistryBuilder {
|
||||
if (reactPackage instanceof LazyReactPackage) {
|
||||
LazyReactPackage lazyReactPackage = (LazyReactPackage) reactPackage;
|
||||
List<ModuleSpec> moduleSpecs = lazyReactPackage.getNativeModules(mReactApplicationContext);
|
||||
List<String> eagerNativeModules = lazyReactPackage.getEagerNativeModules();
|
||||
Map<String, ReactModuleInfo> reactModuleInfoMap =
|
||||
lazyReactPackage.getReactModuleInfoProvider().getReactModuleInfos();
|
||||
|
||||
@@ -52,7 +53,7 @@ public class NativeModuleRegistryBuilder {
|
||||
String className = moduleSpec.getClassName();
|
||||
ReactModuleInfo reactModuleInfo = reactModuleInfoMap.get(className);
|
||||
ModuleHolder moduleHolder;
|
||||
if (reactModuleInfo == null) {
|
||||
if (reactModuleInfo == null || eagerNativeModules.contains(className)) {
|
||||
NativeModule module;
|
||||
ReactMarker.logMarker(
|
||||
ReactMarkerConstants.CREATE_MODULE_START,
|
||||
|
||||
Reference in New Issue
Block a user