fix(0.81): replace RCTUISecureTextField #include hack with proper OOP subclass#2894
Merged
Saadnajmi merged 1 commit intomicrosoft:0.81-stablefrom Apr 8, 2026
Conversation
|
95dff69 to
262d0d6
Compare
tido64
approved these changes
Apr 8, 2026
The old RCTUISecureTextField.m used `#include "../RCTUITextField.mm"` to re-compile the entire implementation with RCT_SUBCLASS_SECURETEXTFIELD defined. This caused duplicate symbol errors in SPM builds because both files were compiled as separate translation units. Replace with a proper OOP subclass: RCTUISecureTextField now inherits from RCTUITextField and overrides only what differs (NSSecureTextFieldCell). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
262d0d6 to
27986b9
Compare
tido64
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backport of #2895 to
0.81-stable.#include .mmtrick inRCTUISecureTextFieldwith proper OOP inheritanceRCTUISecureTextFieldnow subclassesRCTUITextFielddirectly and overrides+cellClassto returnRCTUISecureTextFieldCell : NSSecureTextFieldCellRCT_SUBCLASS_SECURETEXTFIELDpreprocessor conditionals fromRCTUITextField.h/.mmisKindOfClass:[NSSecureTextField class]checks to[RCTUISecureTextField class]in both Paper and Fabric code pathsMotivation
The old approach
#included the entire 734-lineRCTUITextField.mmwith a#defineto swap class/superclass names — a preprocessor trick to work around a diamond inheritance problem. This caused duplicate-symbol linker errors on non-macOS SPM builds and was fragile and confusing.Since
NSSecureTextField's masking behavior lives entirely inNSSecureTextFieldCell, the proper fix is to subclassRCTUITextFieldand override just the cell class (~50 lines of duplicated cell code vs. 734 lines recompiled via include).Test plan
🤖 Generated with Claude Code