react-native-module-template icon indicating copy to clipboard operation
react-native-module-template copied to clipboard

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

Open rgouzal opened this issue 3 years ago • 1 comments

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.

rgouzal avatar Mar 26 '22 14:03 rgouzal

Hello, @rgouzal, @demchenkoalex or @vdanylov.

I have the same problem, did you manage to solve it? If yes, could you help me?

werikesantos avatar Nov 09 '22 00:11 werikesantos