Fix: [iOS][Fabric] Correctly mark inline attachments as clipped when in truncated text range #55518
+10
−1
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.
Title
[iOS] Inline attachments in truncated Text still visible (Fabric)
Description
On iOS with the New Architecture (Fabric), inline attachments in a
<Text>that lie beyond thenumberOfLineslimit are still being rendered instead of being clipped.As a result, the attachment that should be clipped appears just above its wrapper. See screenshots below.
MANDATORY Reproducer
https://snack.expo.dev/@kamildelekta/truncatedtextattachmentvisiblebug
Screenshots of issue
Only
maxLineschanges between these two screenshots. You can check it yourself in the expo snack above.React Native Version
Affected Platforms
only IOS New Arch
Test Plan
Visible cases
Tested multiple layouts where the attachment is in range; the attachment is shown and laid out correctly.
Clipped cases
Tested both clipping paths: (1) attachment after the last visible line →
isOutsideVisibleRange; (2) attachment in the truncated "..." range →isInTruncatedRange. In both cases the attachment is correctly clipped.Context
Before this change we only had
isInTruncatedRange. Handling forisOutsideVisibleRangewas added. The example below shows that these two clipping cases are mutually exclusive; in the app, both cases correctly clip the attachments.Testing code:
and here some examples:
Changelog:
[iOS] [Fixed] - Inline attachments after the last visible line in truncated text are now correctly marked as clipped.
Output of
npx @react-native-community/cli info