Repository navigation
fix(graphics): make default text colors portable - #3174
Jason Morse (JasonVMo) wants to merge 1 commit into
Conversation
Define the shared text-color factory through the selected graphics backend so Android and generic C++ link without the Apple implementation. Preserve Apple's existing semantic label color and cover the factory in ColorTest. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 33ea5c72-8bbd-448d-aa21-c9b99dd03c96
|
Additional validation: the six independent main fixes (#3170–#3175) were combined at e9667492e9 in an isolated worktree. After regenerating Pods from packages/rn-tester, RNTester-macOS and RNTester for arm64/x86_64 iOS simulators both built successfully. Exact commands, corrected codegen invocation, and limitations are recorded in #3175 (integration validation comment). This is build evidence, not live UI or sanitizer qualification; no PR was merged. |
| } | ||
|
|
||
| // [macOS | ||
| // Select by graphics backend, not host OS: C++ also builds on Apple hosts. |
There was a problem hiding this comment.
This comment is a bit too agent-context-window driven.
Saad Najmi (Saadnajmi)
left a comment
There was a problem hiding this comment.
This change feels a bit intrusive in that we have to add an API to Android and iOS (we prefer to not change the base platforms much), and I'm not sure what problem its' trying to solve?
Summary:
The shared
TextAttributes::defaultTextAttributes()callsdefaultForegroundTextColor(), but its only definition is in Apple'sHostPlatformColor.mm. Android and generic C++ graphics builds do not compile that file and cannot link the default text attributes.Color.cppand delegate to the selected graphics backend. Android/C++ keep their upstream opaque-black default, including generic C++ builds hosted on macOS.labelColorbehavior unchanged, including iOS: fix(fabric): Switch default Text color to labelColor #2878 explicitly intended the existing Paper behavior on both Apple platforms.ColorTest.cppsuite. This repairs a fork-only helper; an upstream product change or application-layer workaround would not resolve the missing symbol.Test Plan:
Standalone compiler validation used Apple Clang 21/Xcode 26.4.1 and GoogleTest v1.16.0 restored into a disposable worktree-local harness after the first compile reported missing
gtest/gtest.h. No Pods or original-checkout dependencies were modified..color-validation/color-test-cxx— passed, 2/2 tests..color-validation/color-test-android— passed, 2/2 tests using the Android color backend hosted on macOS, not an Android device/NDK build..color-validation/color-test-apple— passed, 2/2 tests using the actual Apple graphics sources, actual RCTUIKit headers, and an AppKit-initialized GoogleTest runner.Color.cpp— expected link failure, undefinedfacebook::react::defaultForegroundTextColor()..color-validation/default-color-cxxand.color-validation/default-color-android— passed, both equalblackColor()..color-validation/apple-default-color— passed, the actual factory still equalsNSColor.labelColorunder Aqua, DarkAqua, accessibility Aqua, and accessibility DarkAqua; light and dark results remain different.traitCollectionWithTraitsFromCollections:deprecation warnings.git diff --check— passed.xcrun clang-format --output-replacements-xml --lines=<changed ranges> <file>checks — passed, zero replacements across all six files. Whole-filexcrun clang-format --dry-run --Werrorfailed on existing formatting outside the changes; those lines were not reformatted.Exact standalone suite compiler commands
The worktree-local
Reactheader-search symlink points at the repository's actualpackages/react-native/ReactApple/Libraries/RCTUIKitdirectory. The Apple runner only calls[NSApplication sharedApplication], initializes GoogleTest, and runs its tests.Not run: CocoaPods/Xcode/RNTester integration or Paper builds, Android NDK/device integration, iOS/visionOS runtime, Metro, and JS Jest/Flow/lint/format suites (no JS changes). No UI behavior changes are intended on Apple platforms, so no UI screenshots are included.