Electrode Native
v0.31
v0.31
  • Introduction
  • INTRODUCTION
    • Overview
      • What is Electrode Native
      • Why use Electrode Native
      • What is a MiniApp
      • Electrode Native workflow
      • Native dependencies management
      • JS/Native communication
      • Requirements
      • Upgrading Electrode Native
      • Contributing
  • QUICK START
    • Building a Movie application
  • REFERENCE
    • Composite
    • Container
      • What's inside
      • Publication
      • Integration
      • Initialization
      • Launching MiniApps
    • Cauldron
      • Structure
      • Setup
      • Compatibility checks
      • Guidelines
    • Manifest
      • Override
      • Native Modules
      • Configurable Modules
    • Runner
    • APIs
      • Project Generation
      • Implementation
      • Versioning
      • Guidelines
    • Bridge
      • Message Types
      • Communication
      • Leveraging APIs
    • CLI
      • Global CLI
      • Local CLI
    • GLOSSARY
  • CLI COMMANDS
    • add
    • binarystore
      • add
      • get
      • remove
    • code-push
      • patch
      • release
      • promote
    • compat-check
    • create-api-impl
    • create-api
    • create-composite
    • create-container
    • create-plugin-config
    • publish-container
    • transform-container
    • create-miniapp
    • link
    • regen-api
    • regen-api-impl
    • run-android
    • run-ios
    • start
    • unlink
    • upgrade-miniapp
    • why
    • cauldron add
      • dependencies
      • file
      • jsapiimpls
      • miniapps
      • nativeapp
      • publisher
    • cauldron config
      • get
      • set
    • cauldron del
      • dependencies
      • file
      • jsapiimpls
      • miniapps
      • nativeapp
    • cauldron get
      • config
      • dependency
      • nativeapp
    • cauldron repo
      • add
      • clear
      • current
      • list
      • remove
      • use
    • cauldron update
      • dependencies
      • file
      • jsapiimpls
      • miniapps
      • nativeapp
    • cauldron batch
    • cauldron regen-container
    • cauldron upgrade
    • cauldron why
    • platform
      • plugins
        • list
        • search
      • config
        • set
        • get
        • del
        • list
      • install
      • versions
      • uninstall
      • use
Powered by GitBook
On this page
  • Android
  • iOS
  1. REFERENCE
  2. Manifest

Configurable Modules

PreviousNative ModulesNextRunner

Last updated 6 years ago

At runtime, some native modules require additional configuration settings. For example, the react-native-code-push native module requires a deployment key upon initialization.

Configurable plugins have some source code associated to them in the manifest plugin configuration file in addition to the config.json file.

For each configurable plugin added to a container, an extra parameter must be added to the container initialization method that is called by the mobile application. This extra parameter allows the client code to pass the configuration of the plugin--at the time the container is initialized.

This section describes these source files for both Android and iOS.

Android

The following example describes an Android source file.

{PLUGIN_NAME}Plugin.java

In this example, the CodePush plugin file is named CodePushPlugin.java. You can view the configuration in the current master manifest file located

The core of the source file is the hook method. The container invokes the hook method during initialization. The last parameter is the actual Config instance of the plugin as provided by the user when calling the ElectrodeReactContainer initialize method.

public ReactPackage hook(
  @NonNull Application application,
  @NonNull ReactInstanceManagerBuilder reactInstanceManagerBuilder,
  @NonNull Config config)

The Config class for the plugin is declared in the same .java source file. The class should follow the JAVA builder pattern. Mandatory configuration properties should be passed in the constructor, whereas optional properties should be provided using setter methods returning the Config instance to allow chaining.

iOS

The following example describes an iOS source file.

Electrode{PLUGIN_NAME}Config.h and Electrode{PLUGIN_NAME}Config.m

A configuration class should use the ElectrodePluginConfig protocol.

The (void)setupConfigWithDelegate: (id<RCTBridgeDelegate>) method is called during the container initialization.

This example includes two ObjectiveC files for for CodePush plugin: ElectrodeCodePushConfig.h and ElectrodeCodePushConfig.m. You can view the configuration in these files in the current master manifest file located and .

here
here
here