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
Thiago Vinhas (tvinhas) added a commit to tvinhas/react-native-macos that referenced this pull request Oct 28, 2026
Upstream v0.88.1 (30 commits, replayed onto the local v0.88.0 without the
agent files). Conflicts: fork identities and the vlists '*' peer kept;
Hermes 260318099.0.5; RCTStatusBarAppearance, the modal's status bar
capture and RCTRootViewController are iOS-only (macOS has no status bar,
visionOS lacks setNeedsStatusBarAppearanceUpdate); the SwiftUI filter
container sets safeAreaRegions through RCTPlatformHostingController;
SwiftPM autolinking keeps the per-platform UIKit/AppKit linker settings;
RNTester Podfile.lock regenerated with pod install.

Also from microsoft/react-native-macos (open PRs, macOS-only): secure
TextInput focus crash (microsoft#3141), TextInput color for bullets and plain text
(microsoft#3144), TextInput text stays put when resized while focused (microsoft#3150),
ScrollView scrolls over a multiline TextInput (microsoft#3146), inverted lists on
the new architecture (microsoft#3148), press over a TextInput (microsoft#3143), Dimensions
follow window resizes (microsoft#3142, plus removing its observer on invalidate),
RCTView shadow color retained (microsoft#3129), UIImage encoders extern "C"
(microsoft#3140), layout direction constants (microsoft#3131), and codegen skipping
unlinked third-party components (microsoft#3128, upstream react#59067).

.yarnrc.yml preapproves hermes-compiler@260318099.0.5 past the 7-day age
gate.

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