mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-10 22:47:58 +08:00
Setting bridge up for sharing: allowing native modules to register after init
Reviewed By: javache Differential Revision: D4945784 fbshipit-source-id: 80e7236e9ccd5d5c9a7fba7c96b98fc38b43a2fc
This commit is contained in:
committed by
Facebook Github Bot
parent
1ae54b5108
commit
5c5410459e
@@ -157,6 +157,26 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method and the native below permits a CatalystInstance to extend the known
|
||||
* Native modules. This registry contains only the new modules to load. The
|
||||
* registry {@code mNativeModuleRegistry} updates internally to contain all the new modules, and generates
|
||||
* the new registry for extracting just the new collections.
|
||||
*/
|
||||
@Override
|
||||
public void extendNativeModules(NativeModuleRegistry modules) {
|
||||
//Extend the Java-visible registry of modules
|
||||
mNativeModuleRegistry.registerModules(modules);
|
||||
Collection<JavaModuleWrapper> javaModules = modules.getJavaModules(this);
|
||||
Collection<ModuleHolder> cxxModules = modules.getCxxModules();
|
||||
//Extend the Cxx-visible registry of modules wrapped in appropriate interfaces
|
||||
jniExtendNativeModules(javaModules, cxxModules);
|
||||
}
|
||||
|
||||
private native void jniExtendNativeModules(
|
||||
Collection<JavaModuleWrapper> javaModules,
|
||||
Collection<ModuleHolder> cxxModules);
|
||||
|
||||
private native void initializeBridge(
|
||||
ReactCallback callback,
|
||||
JavaScriptExecutor jsExecutor,
|
||||
|
||||
Reference in New Issue
Block a user