Skip to content

Respect enum values for TurboModule c++ codegen (#56478)#56478

Closed
christophpurrer wants to merge 1 commit intofacebook:mainfrom
christophpurrer:export-D101229471
Closed

Respect enum values for TurboModule c++ codegen (#56478)#56478
christophpurrer wants to merge 1 commit intofacebook:mainfrom
christophpurrer:export-D101229471

Conversation

@christophpurrer
Copy link
Copy Markdown
Contributor

@christophpurrer christophpurrer commented Apr 16, 2026

Summary:

Changelog:
[General] [Fixed] - Respect enum values for TurboModule c++ codegen

Defining an enum like this:

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

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 16, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Apr 16, 2026

@christophpurrer has exported this pull request. If you are a Meta employee, you can view the originating Diff in D101229471.

@meta-codesync meta-codesync Bot changed the title Respect enum values for TurboModule c++ codegen Respect enum values for TurboModule c++ codegen (#56478) Apr 17, 2026
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
@meta-codesync meta-codesync Bot closed this in 56129fe Apr 17, 2026
@facebook-github-tools facebook-github-tools Bot added the Merged This PR has been merged. label Apr 17, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Apr 17, 2026

This pull request has been merged in 56129fe.

@react-native-bot
Copy link
Copy Markdown
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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants