Emit name constant as part of Java codegen

Summary:
We have the expected module name available as part of the codegen schema, so we can remove the need for developers to implement the `getName` method as part of their module implementation.

Note that this method is not actually used when the TurboModules infra is used, as the moduleName from the turbo module manager is passed through to the TurboModule base class instead. Moving the method to codegen will make it easier to remove this method altogether once the old architecture is fully removed.

Changelog: [Android][Added] Support generating `getName` in react-native-codegen for Java TurboModules

Reviewed By: mdvacca

Differential Revision: D41615387

fbshipit-source-id: 6b117645fa39e5e9ab014b21198496a52f6f2ae2
This commit is contained in:
Pieter De Baets authored and Facebook GitHub Bot committed 2022-12-07 06:35:01 -08:00
1 parent e1bca8f98c
commit 90538909f9
17 files changed
+221 -247

No files matched your search

@@ -7,8 +7,8 @@
package com.facebook.react.bridge;
import androidx.annotation.NonNull;
import com.facebook.proguard.annotations.DoNotStrip;
import javax.annotation.Nonnull;
/**
* A native module whose API can be provided to JS catalyst instances. {@link NativeModule}s whose
@@ -29,7 +29,7 @@ public interface NativeModule {
* @return the name of this module. This will be the name used to {@code require()} this module
* from javascript.
*/
@NonNull
@Nonnull
String getName();
/**