Text immediately before an `<img>` sometimes fails to repaint on iOS after a screen revisit (`EnrichedText`)
Maintainer thường phản hồi trong vòng 4 ngày
Một pull request liên quan đã được merge.
- #804 của @hejsztynx — đã merge
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- ios, objective-c, react-native
- Lĩnh vực
- mobile
Hướng nghiên cứu
Bắt đầu trong EnrichedTextView.mm, đặc biệt là renderContent, và so sánh cách xử lý textStorage và layout với EnrichedTextInputView.mm và _performRelayout. Tái hiện vấn đề thông qua expo-router hoặc React Navigation với react-native-screens bằng cách rời khỏi rồi quay lại màn hình trên iOS. Hoàn tất khi văn bản ngay trước một luôn được vẽ trong các lần truy cập tiếp theo mà không làm suy giảm việc render ban đầu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
When EnrichedText renders HTML containing an <img>, the text on the line immediately before that image can fail to visually paint on iOS. The text is still present and correctly positioned (confirmed via the accessibility tree), but it never gets drawn. The rest of the surrounding content renders fine.
This issue is specifically correlated with revisiting a screen via React Navigation (@react-navigation/native + react-native-screens native-stack, via expo-router). A fresh first visit renders correctly, but navigating away and then back causes the line to reliably or intermittently fail to paint. This is an iOS-only issue and does not reproduce on Android.
Investigation ruled out JS-side remount timing issues (the bug persists even with zero remounts/key changes on revisit, or when forcing fixed-delay remounts).
To Reproduce
Steps to reproduce the behavior:
- In an app using
expo-routeror@react-navigation/native(withreact-native-screens), create a screen that rendersEnrichedText. - Provide HTML ending in a text block immediately followed by an
<img>, e.g.,...<div>Some text</div><img src="..." width="..." height="..." />. - Navigate to that screen. (Observe that it renders correctly).
- Navigate back to the previous screen.
- Navigate forward to the same screen again.
- See error: The line of text immediately before the
<img>is now blank (though still present and correctly positioned in the accessibility tree).
Expected behavior
The text immediately preceding the <img> tag should consistently paint and remain visible on subsequent visits to the screen, mirroring the behavior of the initial visit.
Screenshots
(Not applicable/No screenshot provided — visually, it manifests as empty space where the text should be).
Device (please complete the following information):
- Device: iPhone 17 Pro (iOS Simulator)
- OS: iOS 26.4
- Version:
react-native-enriched-htmlv1.1.1 (Running on React Native 0.86.3, Expo ~57.0.20, Fabric new architecture)
Additional context
Reproduction context: This issue could not be reproduced in isolation (e.g., via a Storybook story with identical HTML and remount behavior). It strictly depends on real React Navigation transition/view-controller behavior.
Potential contributing factor identified: In EnrichedTextView.mm, renderContent fully rebuilds textView.textStorage on every render but never explicitly invalidates/re-lays-out the NSLayoutManager around the changed content. This contrasts with the editable EnrichedTextInputView.mm, which works around similar TextKit gaps via _performRelayout. Patching EnrichedTextView to mirror this sequence did not reliably fix this specific bug on its own, but it highlights a potential TextKit gap.
Questions for maintainers:
- Is there a known interaction between
EnrichedTextView's render/layout cycle and view controller appearance/reappearance (e.g.,viewWillAppear/native view recycling) that could cause a stale/incomplete TextKit layout pass specifically on a view's second-or-later appearance in a navigation stack? - Are there any existing instrumentation or debug flags in the library for tracing
NSLayoutManagerinvalidation timing to help build a tighter reproduction?
- Ngôn ngữ chính
- C
- Star
- 1.4k
- Fork
- 73
- Merge trung bình
- 3 ngày 19 phút
- Pull request đã merge (30 ngày)
- 12
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của software-mansion/react-native-enriched-html
-
bug missing repro
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
software-mansion/react-native-enriched-html#833 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
[Feature request] Vertical spacing (margins) for headings and lists in htmlStyleCó thể đã có người làm @henrikra đã nhận 4 ngày trước. Đang mởenhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
software-mansion/react-native-enriched-html#832 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
software-mansion/react-native-enriched-html#818 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
[iOS] Tags not parsed on iOS below a certain string lengthCó thể đã có người làm @hejsztynx đã nhận 13 ngày trước. Đang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
software-mansion/react-native-enriched-html#811 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 50/100
software-mansion/react-native-enriched-html#810 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của software-mansion/react-native-enriched-html
Issue tương tự
-
documentation
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 91/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement ui
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
ChupathingyCE/chupathingyce#485 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Need to correct all URLsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
eclipse-paho/paho.mqtt.c#1727 ·
Maintainer thường phản hồi trong vòng 6 ngày