Repository navigation
Fix iOS 17 Metal errors when TextInput caret is hidden - #58158
Open
levibuzolic wants to merge 1 commit into
Open
levibuzolic wants to merge 1 commit into
levibuzolic wants to merge 1 commit into
Conversation
levibuzolic
marked this pull request as ready for review
August 27, 2026 06:51
Preserve UIKit caret geometry and hide collapsed carets with transparent tint. Restore selection tint when ranges expand, collapse during typing, or move to a new backing view. Exercise the caret transitions in RNTesterUnitTests and run the focused suite in iOS CI. Include the existing Swift import probe in the unit-test target so Xcode links the Swift support libraries required by React Native's dependencies.
levibuzolic
force-pushed
the
fix/text-input-caret-hidden-surface-too-large
branch
from
October 28, 2026 05:51
282baa0 to
761a5ff
Compare
This branch has not been deployed
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:
Fixes #58157.
On iOS 17.2, a single-line
TextInputwithcaretHiddencan repeatedly logSurface 1073741823 x 1073741823 is too largeas the caret moves. This can also stop XCUITest from considering the app idle.The problem comes from returning
CGRectZerofor the caret.This PR leaves the rectangle alone and hides the caret with a transparent tint instead. Non-empty selections still use
selectionColor, so their highlights and handles remain visible.The tint is also updated after typing replaces a selection, and when switching between single-line and multiline inputs. Otherwise, those transitions can leave the caret visible or lose the selection color.
Changelog:
[IOS] [FIXED] - Prevent hidden TextInput carets from causing repeated Metal surface errors.
Test Plan:
Built RNTester from source and ran
RCTUITextFieldTestson an iPhone 16 simulator with iOS 18.0 and Xcode 27.1. All 10 tests passed with Address Sanitizer and Undefined Behavior Sanitizer enabled. The tests are now included in the RNTester unit-test target and run by iOS CI.Also checked typing, replacing selected text, selection highlights and handles, and switching between single-line and multiline inputs in RNTester. The caret stayed hidden and selections kept their configured color. No matching surface errors appeared in the logs. Formatting checks passed.
The original iOS 17.2 repro produced 615 errors in 15 seconds before the fix and none afterward. I couldn't repeat that check after rebasing because the 17.2 runtime isn't installed here.
The full RNTester test build hit a Swift compatibility linker error in
RNTesterIntegrationTests(__swift_FORCE_LOAD_$_swiftCompatibility56), so I ran the unit-test target separately. Mac Catalyst and physical devices weren't retested.Native test command