[macOS] Fix Fabric TextInput border rendering#2739
Conversation
Co-authored-by: Saadnajmi <6722175+Saadnajmi@users.noreply.github.com>
…ing clipsToBounds Co-authored-by: Saadnajmi <6722175+Saadnajmi@users.noreply.github.com>
… in prepareForRecycle Co-authored-by: Saadnajmi <6722175+Saadnajmi@users.noreply.github.com>
|
@copilot a whole lot of changes made it in that are formatting changes or random JS changes. I only want to see changes in RCTTextInputComponentView |
Co-authored-by: Saadnajmi <6722175+Saadnajmi@users.noreply.github.com>
Removed all unrelated changes. The PR now only includes changes to RCTTextInputComponentView.mm (and .gitignore to prevent dist/ from being committed in the future). Commit: 4a62aa3 |
|
@copilot still a lot of formatting only changes |
… fix Co-authored-by: Saadnajmi <6722175+Saadnajmi@users.noreply.github.com>
|
@copilot this works when I test locally, but seems much. I think all we need is |
Co-authored-by: Saadnajmi <6722175+Saadnajmi@users.noreply.github.com>
|
@copilot Undo the change to gitignore |
Co-authored-by: Saadnajmi <6722175+Saadnajmi@users.noreply.github.com>
|
Closing as I debugged myself and found a different solution |
|
nevermind, still needed.. |
The non- The Issue:
Why the fix works: Alternative fix: |
Fix Fabric TextInput missing border rendering on macOS
Problem
When Fabric is enabled on macOS,
TextInputcomponents don't render borders. This affects both single-line and multi-line text inputs.Root Cause
On macOS, views are layer-backed (
wantsLayer = YES), which creates a specific rendering hierarchy where subviews always render on top of sublayers regardless of z-position values. TextInput uses a nativeNSTextFieldorNSTextViewas a direct subview, and when borders are rendered using the custom border layer approach, the border sublayer appears behind the text field subview.Solution
Force Core Animation border rendering by setting
clipsToBounds = YESininitWithFrameon macOS. This triggers theuseCoreAnimationBorderRenderingcode path which renders borders directly on the main layer usinglayer.borderWidthandlayer.borderColor.Changes
Simple one-line fix in
initWithFrame:- SetclipsToBounds = YESon macOS to enable proper border rendering.Testing
Tested locally and confirmed to work correctly.
Fixes #2738
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.