Skip to content

Renaming module template causes module to return as null in JS (Android) #26

@rgouzal

Description

@rgouzal

Steps to produce the problem:

  1. git cloned repository
  2. 'yarn' on root lib dir to install needed packages for module
  3. run node rename.js
  4. cd into example and run command 'yarn' to install any packages needed for example app
  5. run yarn start to metro bundler
  6. compile with 'react-native run-android'

These steps will run the module fine and will show module on console log but after doing the steps below it will not show as null in console log:
7) Modified in Android 'getName' function to return "CustomModule" instead of "RNModuleTemplateModule"
8) Change in index.js of module
From:export default NativeModules.RNModuleTemplateModule
To:export default NativeModules.CustomModule
9) Clean project with ./gradlew clean
10) Recompile again with "react-native run-android"

Result: module returning as null in console log

I even tried to change the module class name and file in Android but same problem occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions