public interface NativeModule
NativeModule
s whose
implementation is written in Java should extend BaseJavaModule
or ReactContextBaseJavaModule
. NativeModule
s whose implementation is written in C++
must not provide any Java code (so they can be reused on other platforms), and instead should
register themselves using CxxModuleWrapper
.Modifier and Type | Interface and Description |
---|---|
static interface |
NativeModule.NativeMethod |
Modifier and Type | Method and Description |
---|---|
boolean |
canOverrideExistingModule()
Return true if you intend to override some other native module that was registered e.g.
|
java.util.Map<java.lang.String,NativeModule.NativeMethod> |
getMethods() |
java.lang.String |
getName() |
void |
initialize()
This is called at the end of
CatalystApplicationFragment#createCatalystInstance()
after the CatalystInstance has been created, in order to initialize NativeModules that require
the CatalystInstance or JS modules. |
void |
onCatalystInstanceDestroy()
Called before {CatalystInstance#onHostDestroy}
|
void |
writeConstantsField(com.fasterxml.jackson.core.JsonGenerator jg,
java.lang.String fieldName)
Append a field which represents the constants this module exports
to JS.
|
java.lang.String getName()
require()
this module
from javascript.java.util.Map<java.lang.String,NativeModule.NativeMethod> getMethods()
void writeConstantsField(com.fasterxml.jackson.core.JsonGenerator jg, java.lang.String fieldName) throws java.io.IOException
java.io.IOException
void initialize()
CatalystApplicationFragment#createCatalystInstance()
after the CatalystInstance has been created, in order to initialize NativeModules that require
the CatalystInstance or JS modules.boolean canOverrideExistingModule()
void onCatalystInstanceDestroy()