react-native-vector-icons
, react-native-code-push
or react-native-maps
for example. And the React Native open source community provides many additional native modules that could be used in your MiniApps.react-native link
command (formerly the rnpm
command) to add a React Native plugin (native module) to your React Native application. However, Electrode Native requires that you add the native modules to a container library--not directly to a mobile application.ern
0.3.0
, the Electrode Native platform looks for a matching plugin configuration in the plugins/ern_v0.2.0+
directory. If you are using version ern 0.5.0
, the Electrode Native platform looks for a matching plugin configuration first in the plugins/ern_v0.4.0+
directory and if the configuration is not found that directory, the platform looks in the plugins/ern_v0.2.0+
directory.react-native-maps
.react-native-code-push
plugin. The directory is located here​CodePushPlugin.java
file contains configuration information to add the CodePush native module package to the list of native modules--to be loaded by React Native upon initialization of the Android Container library. The file can optionally include the configuration to allow the mobile app to configure the native module.ElectrodeCodePushConfig.h
file and ElectrodeCodePushConfig.m
file contains similar code for the iOS platform.config.json
file holds the actual plugin configuration. It contains instructions that the container generator will use to add the plugin to the container.android
and/or ios
. If a plugin is only supported on one platform, it will only contain that specific platform object.platform agnostic directives
can be used for both iOS and Android platforms.platform specific directives
can be used only in the context of a specific platform.copy
copy
directive is an array of objects, each containing a specific copy statement. The objects contain a source
property and a dest
property:source
: A single file path or directory glob indicating the files to copydest
: A target directory where the files will be copied toios
directory to the container /Libraries/CodePush
directory.copy
statement in the config.json
file. For the most part, in iOS, the dest
will be "{{{projectName}}}/Libraries/{PLUGIN_NAME}"
. projectName
will be replaced during Container generation by the name of the project (ElectrodeContainer
in the case of container generation), while PLUGIN_NAME
should be the name of the plugin itself.replaceInFile
replaceInFile
directive is an array of objects, each containing a specific replacement statement. The objects contain a path
property, a string
property and a replaceWith
property:path
: Path to the file that contains a string to be replacedstring
: String to be replacedreplaceWith
: The new string"RCTBridgeModule.h"
with <React/RCTBridgeModule.h>
in the /Libraries/RNLocation/RNLocation.h
file in the container.applyPatch
git apply
command, from a specific directory. The value of this property should be a single object containing the following two properties :patch
: Path to the patch file to apply, relative to the directory containing the pluging configuration file (config.json
).root
: Path to the directory from which to run the git apply
command, relative to the container generator output directory. Mutually exclusive with inNodeModules
.inNodeModules
: If true, root will be set to root location of the plugin in node nodules. Mutually exclusive with root
.example.patch
patch file, by running git apply
command from the {{{projectName}}}/Libraries/ExampleNativeModule
directory.android
configuration object.moduleName
module
containing the plugin. By default, the plugin configuration uses lib
, which is the convention most Android plugins adopt to name the module containing the plugin code.root
android
, which is the convention followed by most third-party native modules.dependencies
implementation
statements in the container build.gradle
file.implementation <groupId>:<artifactId>:<version>
format, it is possible to set the full dependency statement to be injected in the build.gradle
as illustrated in the following example:features
src/main/res
) you can use the copy
directive to copy the resources directories to the container. For example, assuming the android resources directory is located in android/src/main/res
(relative to the root of the native module package), and the package name of the native module is react-native-example
, then you should add the following directive to properly copy the native modules resources to the container :R
generated class, you'll have to make sure to update all imports of this class in the source files importing this class, to use the container namespace rather than the native module one. You can do so using replaceInFile
directive, as illustrated:ios
configuration object.containerPublicHeader
pbxProj
. The pbxProj
directive can include directives used to manipulate the container .pbxproj
file.addProject
xcodeproj
and its target library to the Container. - path
: Path to the xcodeproj
of the plugingroup
: Group to add the project to (Libraries
should be used)staticLibs
: An array of static libraries, targets of the plugin project, to link with the ContaineraddHeaderSearchPath
addHeader
path
: Path to the header file to addgroup
: Group containing the header - public
: Boolean indicated whether the header should be public or not (default to false)addSource
path
: Path to the source file to add - group
: Group containing the source filesetBuildSettings
ENABLE_BITCODE
to NO
for Debug
and Release
configurations of Example
plugin project :copy
directive to copy the resources to the container. For example, assuming the following ios/example/resources
directory structure (relative to the root of the native module package)copy
directive as illustrated belowdest
should always be set to {{{projectName}}}/Resources
. During container generation, ern will add any resources present in this directory, to the container xcode project.podFile
podspec
extraPods
extraPodspecsSources
extraPodfileStatements
requiresManualLinking
true
, all plugin directives will be processed. If not defined (default) or set to false, only podFile
, podspec
and extraPods
directives will be processed.\n This should only be set to true
in very rare cases, for plugins that do not support auto linking.