Add module name constant to class for downstream use (#38295)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38295

Move constant to class instance so customers can use strongly typed name, feedback from D46159001

Changelog:
[Internal] [Changed] - Add module name constant to codegen'd class for downstream use

Reviewed By: christophpurrer

Differential Revision: D47095993

fbshipit-source-id: 741d0d837bf912d6b32e5f12c5df871563d46686
This commit is contained in:
Roy Berger
2023-07-11 13:03:17 -07:00
committed by Facebook GitHub Bot
parent 8e9062849e
commit f396067cca
3 changed files with 129 additions and 43 deletions
@@ -74,9 +74,11 @@ public:
return delegate_.get(rt, propName);
}
static constexpr std::string_view kModuleName = "${moduleName}";
protected:
${hasteModuleName}CxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
: TurboModule("${moduleName}", jsInvoker),
: TurboModule(std::string{${hasteModuleName}CxxSpec::kModuleName}, jsInvoker),
delegate_(static_cast<T*>(this), jsInvoker) {}
private: