Respect enum values for TurboModule c++ codegen (#56478)#56478
Closed
christophpurrer wants to merge 1 commit intofacebook:mainfrom
Closed
Respect enum values for TurboModule c++ codegen (#56478)#56478christophpurrer wants to merge 1 commit intofacebook:mainfrom
christophpurrer wants to merge 1 commit intofacebook:mainfrom
Conversation
|
@christophpurrer has exported this pull request. If you are a Meta employee, you can view the originating Diff in D101229471. |
c09ac69 to
1f09695
Compare
christophpurrer
pushed a commit
to christophpurrer/react-native-macos
that referenced
this pull request
Apr 17, 2026
Summary:
[General] [Fixed] - Respect enum values for TurboModule c++ codegen
Defining an enum like this:
```js
export enum CustomPropertyEditor {
BitMask = 0,
Entity = 1,
Slider = 2,
AudioEvent = 3,
CollisionLayer = 4,
MaterialComponentDeprecatedProperty = 5,
MeshMaterialList = 6,
Submesh = 7,
// CoreUiLayout (8) removed — rendered identically to ClassOrList
MaterialMapJson = 9,
AnimationTable = 10,
SkeletonAsset = 11,
NavMeshAreaType = 12,
VFXAsset = 13,
Table = 14,
VariableTable = 15,
AudioBus = 16,
LodSettings = 17,
WorldSearch = 18,
EntityMaterialList = 19,
NpcId = 20,
LightingModelVersion = 21,
PlatformSelector = 22,
ComponentReference = 23,
}
```
(notice number 8 ), will cause the generated enum to actually look like:
```
enum class NativeEditableObjectModuleCustomPropertyEditor {
BitMask, Entity, Slider, AudioEvent, CollisionLayer,
MaterialComponentDeprecatedProperty, MeshMaterialList, Submesh,
MaterialMapJson, AnimationTable, ...
};
```
in other words, the values don't match up after the core ui value. This is quite dangerous and I'm surprised no one has ever noticed that
This diff fixes things such that if an integer value is explicitly assigned, the value is preserved in the generated enum.
Reviewed By: christophpurrer
Differential Revision: D101229471
Summary:
Changelog:
[General] [Fixed] - Respect enum values for TurboModule c++ codegen
Defining an enum like this:
```js
export enum CustomPropertyEditor {
BitMask = 0,
Entity = 1,
Slider = 2,
AudioEvent = 3,
CollisionLayer = 4,
MaterialComponentDeprecatedProperty = 5,
MeshMaterialList = 6,
Submesh = 7,
// CoreUiLayout (8) removed — rendered identically to ClassOrList
MaterialMapJson = 9,
AnimationTable = 10,
SkeletonAsset = 11,
NavMeshAreaType = 12,
VFXAsset = 13,
Table = 14,
VariableTable = 15,
AudioBus = 16,
LodSettings = 17,
WorldSearch = 18,
EntityMaterialList = 19,
NpcId = 20,
LightingModelVersion = 21,
PlatformSelector = 22,
ComponentReference = 23,
}
```
(notice number 8 ), will cause the generated enum to actually look like:
```
enum class NativeEditableObjectModuleCustomPropertyEditor {
BitMask, Entity, Slider, AudioEvent, CollisionLayer,
MaterialComponentDeprecatedProperty, MeshMaterialList, Submesh,
MaterialMapJson, AnimationTable, ...
};
```
in other words, the values don't match up after the core ui value. This is quite dangerous and I'm surprised no one has ever noticed that
This diff fixes things such that if an integer value is explicitly assigned, the value is preserved in the generated enum.
Reviewed By: christophpurrer
Differential Revision: D101229471
1f09695 to
761ccc9
Compare
|
This pull request has been merged in 56129fe. |
Collaborator
|
This pull request was successfully merged by @akawrykow in 56129fe When will my fix make it into a release? | How to file a pick request? |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Changelog:
[General] [Fixed] - Respect enum values for TurboModule c++ codegen
Defining an enum like this:
(notice number 8 ), will cause the generated enum to actually look like:
in other words, the values don't match up after the core ui value. This is quite dangerous and I'm surprised no one has ever noticed that
This diff fixes things such that if an integer value is explicitly assigned, the value is preserved in the generated enum.
Reviewed By: christophpurrer
Differential Revision: D101229471