Use hasteModuleName for C++ Turbo Module enums (#44631)

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

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module enums

This is a follow up to https://github.com/facebook/react-native/pull/44630

This changes the names of C++ Turbo Modules enums to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export enum EnumNone {
  NA,
  NB,
}

export interface Spec extends TurboModule {
  +getStrEnum: (arg: EnumNone) => EnumStr;t
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxEnumNone
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleEnumNone
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

Reviewed By: cipolleschi

Differential Revision: D57602082

fbshipit-source-id: 9ebd68b8059dfbc6e2ec11065915cf049aa3cb0b
This commit is contained in:
Christoph Purrer
2024-05-23 10:23:36 -07:00
committed by Facebook GitHub Bot
parent b98c5b960c
commit b7fc5867f2
4 changed files with 89 additions and 84 deletions
@@ -81,16 +81,16 @@ GraphNode NativeCxxModuleExample::getGraphNode(
return arg;
}
NativeCxxModuleExampleCxxEnumInt NativeCxxModuleExample::getNumEnum(
NativeCxxModuleExampleEnumInt NativeCxxModuleExample::getNumEnum(
jsi::Runtime& rt,
NativeCxxModuleExampleCxxEnumInt arg) {
NativeCxxModuleExampleEnumInt arg) {
return arg;
}
NativeCxxModuleExampleCxxEnumStr NativeCxxModuleExample::getStrEnum(
NativeCxxModuleExampleEnumStr NativeCxxModuleExample::getStrEnum(
jsi::Runtime& rt,
NativeCxxModuleExampleCxxEnumNone arg) {
return NativeCxxModuleExampleCxxEnumStr::SB;
NativeCxxModuleExampleEnumNone /*arg*/) {
return NativeCxxModuleExampleEnumStr::SB;
}
std::map<std::string, std::optional<int32_t>> NativeCxxModuleExample::getMap(