Repository navigation
fix(textinput): restore macOS Fabric trait conversion - #3173
Jason Morse (JasonVMo) wants to merge 1 commit into
Conversation
Parse submit key events and clear-on-submit traits, and route invalid paste types through the existing recoverable prop conversion boundary. Add native parser regressions for modifiers, prop updates and paste input validation. 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] | ||
|
|
||
| #import <TargetConditionals.h> | ||
|
|
||
| #if TARGET_OS_OSX | ||
| #import <XCTest/XCTest.h> | ||
|
|
||
| #include <react/renderer/components/iostextinput/TextInputProps.h> |
There was a problem hiding this comment.
This path I think is more for paper tests, but also we really don't need to be adding tests I think. I don't really see native tests like these much in React Native much less its' forks. I'm not sure what any of theses tests would catch vs hwo brittle they are to upstream refactors.
| #if TARGET_OS_OSX // [macOS | ||
| #include <stdexcept> | ||
| #endif // macOS] |
There was a problem hiding this comment.
There's no other more standard way to throw errors in RN's C++ code?
Summary:
Restore macOS-only Fabric TextInput trait conversion:
submitKeyEventsandclearTextOnSubmit. feat(fabric): Pick the rest of TextInput changes #2727 (90ce6058f5) added the traits, event converter, and consumer but omitted these assignments. Both props therefore remained at their defaults, including on current main after fix(macos): Fabric accessibility roles and state, and TextInput read-only and Tab-stop fixes #3136.pastedTypes' unconditional abort with an exception handled by the existingconvertRawPropdiagnostic/default boundary. Validate string types before casting, including array entries. Valid scalar and array forms remain supported; malformed input falls back to the declared empty-list default.React-RCTFabric/Testssuite covering modifier combinations, inheritance/replacement/removal, valid paste forms, and invalid string/non-string input.The paste abort introduced by #2715 copied an older upstream conversion pattern. Upstream subsequently removed the adjacent TextInput aborts in react#50764; the macOS-specific converter was left behind. Paper already handles unknown paste type names without aborting. No overlapping fix was found in the PR/issue searches.
These are fork-only props, so an upstream change or JS wrapper would not repair the missing native conversion. All production changes are under
TARGET_OS_OSX; iOS, Android, and Paper are unchanged.The existing multiline consumer uses unmodified Enter for an empty/omitted key list and exact modifier matching for custom entries. This PR does not change event ordering, key handling, or single-line/secure inputs, which use the separate
submitBehaviorpath.Test Plan:
Parser regressions: red/green
Compiled the real changed
TextInputProps.cppand the new XCTest source against existing, read-only macOS Pods archives using Xcode 26.4.1. Baseline runs use the pristine conversion headers from0b569f1497.Commands from the repository root:
Expected baseline failure: exit 1, one test with two failed assertions:
clearTextOnSubmitis false andsubmitKeyEvents.size()is 0.Expected baseline crash: exit 134/SIGABRT for an unknown JS paste type string.
Passed: exit 0, four tests, zero failures. Invalid strings and numeric values log
Error while converting prop 'pastedTypes'and select the default instead of terminating.Exact direct XCTest compile/link command
The bundle is a local validation artifact, not new repository tooling. The test source is discovered by the existing
React-RCTFabrictest-spec glob.Passed: exit 0. No existing Pods/build output was modified.
iOS guard compilation
Exact iOS simulator translation-unit check
Passed: exit 0, no diagnostics.
Formatting
All passed. The initial whole-header format check failed on formatting already present in both pristine headers; only changed lines were checked to avoid reformatting upstream code.
Tooling setup:
yarn install --immutablepassed with existing warnings afteryarn exec clang-format --versionreported missing install state. The npm formatter binary subsequently failed to execute on this host (spawn Unknown system error -86); the installedxcrun clang-format21.0.0 was used instead.Not run: full RNTester-macOS/iOS builds, Paper/Android builds, interactive UI/IME/secure-input testing, full native suite, Jest/Flow/JS lint (no JS changes). No screenshots: this is a parser-only fix; the existing RNTester “Clear text on submit - Multiline Textfield” example is the manual UI follow-up.