mirror of
https://github.com/react/react-native.git
synced 2026-09-28 13:23:09 +08:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/56478 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 fbshipit-source-id: 366ea2d16ac74e112f1b68c5ad3d0877dedb918c