forked from microsoft/react-native-macos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use hasteModuleName for C++ Turbo Module structs (facebook#44630)
Summary: Changelog: [General][Breaking] Use hasteModuleName for C++ Turbo Module structs This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`. Example: `NativeMyAbcModule.js` with this spec: ``` export type ValueStruct = { x: number, y: string, z: ObjectStruct, }; export interface Spec extends TurboModule { +getValueStruct: () => ValueStruct } export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec); ``` Before now we generated a base C++ struct with the name: ``` MyAbcModuleCxxValueStruct ^^^ ``` Now the generate name is: ``` NativeMyAbcModuleValueStruct ^^^^^^ ``` ## Changes: - No `Cxx` injected anymore - Ensure base struct is `Native` prefixed (all RN JS TM specs start with it) ## Why? - The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually - The C++ base struct name should be 'stable' - The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not - The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class - The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above Reviewed By: cipolleschi Differential Revision: D57599257
- Loading branch information
1 parent
9dfcb9e
commit 19d0867
Showing
7 changed files
with
121 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.