Skip to content

fix(macos): define the layout direction constants as NSUserInterfaceLayoutDirection values - #3131

Draft
Saad Najmi (Saadnajmi) wants to merge 1 commit into
microsoft:mainfrom
Saadnajmi:fix-macos-layout-direction-constants
Draft

Saad Najmi (Saadnajmi) wants to merge 1 commit into
microsoft:mainfrom
Saadnajmi:fix-macos-layout-direction-constants

Conversation

@Saadnajmi

Copy link
Copy Markdown
Collaborator

Summary:

On macOS, RCTUIKit defines UIUserInterfaceLayoutDirection as NSUserInterfaceLayoutDirection, but declares UIUserInterfaceLayoutDirectionLeftToRight and UIUserInterfaceLayoutDirectionRightToLeft in a separate anonymous enum. Comparing a layout direction with them, as RCTTextAttributes.mm does, mixes two enumeration types. C++20 deprecates that, and clang warns with -Wdeprecated-anon-enum-enum-conversion, which breaks builds that treat warnings as errors.

This defines the two constants as the matching NSUserInterfaceLayoutDirection values, so both sides of the comparison have the same type.

Test Plan:

Built the same change to React/Base/RCTUIKit.h on 0.81 in Office for macOS arm64 and x86_64, with warnings as errors and without suppressing -Wdeprecated-anon-enum-enum-conversion: RCTTextAttributes.mm compiles cleanly. CI covers main.

…ayoutDirection values

On macOS, RCTUIKit makes UIUserInterfaceLayoutDirection an alias of
NSUserInterfaceLayoutDirection, but declared the LeftToRight and RightToLeft
constants in a separate, unnamed enum. Comparing a layout direction with them, as
RCTTextAttributes.mm does, mixes two enumeration types, which C++20 deprecates and
clang reports with -Wdeprecated-anon-enum-enum-conversion.

Define the constants as the NSUserInterfaceLayoutDirection values, like the type.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 33ac4470-c1d2-43c0-92ee-8407909f0f6a

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant