<img> wider than its rendering column fails to paint on Android — silently in isolation, with an "invalid measurement" error alongside any other text (not a decode-timing race)
Maintainer thường phản hồi trong vòng 2 ngày
Đá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
- 55/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ệ
- android, react-native
- Lĩnh vực
- mobile
Hướng nghiên cứu
Bắt đầu với MeasurementStore.measure() và đường dẫn hình ảnh Android liên quan đến AsyncDrawable và ImageDecoder.setTargetSize. Chạy bản tái hiện tối thiểu được liên kết với ba trường hợp hình ảnh quá lớn, sau đó so sánh hành vi đo trên một dòng và nhiều dòng, cùng với nhật ký đo không hợp lệ. Được xem là hoàn tất khi hình ảnh quá lớn không còn âm thầm thất bại hoặc biến mất trong quá trình kết xuất.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describes the bug
An <img> tag whose declared width exceeds the actual width of the column EnrichedText renders it into fails to paint on Android. This is fully deterministic — not a timing race — and reproduces on the very first cold launch, every time.
I originally filed this issue theorizing an unsynchronized bounds race in AsyncDrawable (ImageDecoder.setTargetSize reading a still-zero Rect before the text-layout pass assigns real bounds). That was a plausible read of the source, but after extensive testing (cold cache, warm cache, a local low-latency image server, and the exact resolve-then-remount sequence a real consuming app uses, run concurrently across 16 images) I was never able to reproduce it. Everything I've actually observed — including the original production bug that led me to file this — is fully explained by the mechanism below instead, with no timing element at all. Retracting that theory.
The failure takes two different shapes depending on context:
- The
<img>is the only content in theEnrichedText— the failure is completely silent. No exception, no broken-image placeholder, nothing logged anywhere. - There's any other text in the same
EnrichedText(true of essentially all real admin-authored content — headings, paragraphs, etc. around an image) — the same failure now logs a concrete diagnostic:ReactNativeJNI: EnrichedTextView returned an invalid measurement. Min: [0,0] Max: [384,inf] Actual: [400,404.333]Maxis the real available column width;Actualis what the measure function reported back, driven by the embedded image's declared size.
This split traces to MeasurementStore.measure(): single-line content reports StaticLayout.getLineWidth(0), but multi-line content reports StaticLayout.width instead — and that can still exceed the nominal wrap width when one line contains an unsplittable inline image wider than the rest.
To Reproduce
Minimal repro app: https://github.com/ekrapfl/rne-html-repro-android-img-paint
npm install && npm run android(native dev build, Fabric).- Three cases render: an image that fits (paints normally), the same image declared far wider than the screen with no other content (renders at full size, overflowing the screen edge uncropped), and that same oversized image with a paragraph before it (reserves no visible space, shows nothing).
adb logcat | grep -i "invalid measurement"around the third case.
Expected behavior
An oversized declared width shouldn't cause total, silent render failure. At minimum, a diagnostic should surface consistently (right now it only does when there's other text in the same view); ideally the library would clamp/scale the image to the available column itself, the way a browser does with img { max-width: 100% }, rather than leaving every consumer to compute and inject a safe pixel width themselves.
Device tested
- Pixel 10 Pro XL emulator (
sdk_gphone16k_arm64), Android API 37 react-native-enriched-html1.1.1, React Native 0.86.3, Expo ~57.0.23, Fabric (New Architecture)
Additional context
One honest caveat: the visual failure reproduces reliably in the minimal repro above, on a fresh cold install, every time. The exact JNI log line was confirmed repeatedly against a full production app under a matching layout structure, but hasn't fired in the standalone repro despite matching nesting depth, padding, and styling — something about the fuller app context matters there that I haven't isolated. The visual symptom (reserves no space, never paints) is the same failure either way.
- Ngôn ngữ chính
- C
- Star
- 1.4k
- Fork
- 68
- Merge trung bình
- 3 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 6
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
-
HIGH level tiptap package advisoryCó thể đã có người làm @hejsztynx đã nhận 16 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
software-mansion/react-native-enriched-html#802 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Support for `<raw-text-block>`Đang mởenhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
software-mansion/react-native-enriched-html#803 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Text immediately before an `<img>` sometimes fails to repaint on iOS after a screen revisit (`EnrichedText`)Có thể đã có người làm @hejsztynx đã nhận 16 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 38/100
software-mansion/react-native-enriched-html#798 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Android] Native undo restores text but silently strips inline styles, links, and list structureĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
software-mansion/react-native-enriched-html#749 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Android] Inline styles are stripped from previously-styled text when toggling a style OFF mid-word with predictive text enabledCó thể đã có người làm @woosanggyu đã nhận 70 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 48/100
software-mansion/react-native-enriched-html#734 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của software-mansion/react-native-enriched-html
Issue tương tự
-
#242 leftovers: dated narrative and shas in the social-features test planCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
EchoTools/nevr-runtime#264 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area/docdb kind/bug priority/medium status/awaiting-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
yugabyte/yugabyte-db#34873 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[sqlcipher] update to 4.19.0Đang mởcategory:port-update
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
mypaint/libmypaint#209 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày